@lexi.ch home, code, stuff

Sum the file size of found files (Linux) 11.09.2009

To sum the size of files searched with find or another method, use the following snippet using AWK to get the total size:

find . -xdev -type f -ctime +1 | xargs ls -l | awk 'BEGIN { SUM = 0 } { SUM += $5 } END { print SUM }'