If you wish to calculate a total size for all files in a directory on a Unix, Linux, or Mac system running Apple's OS X operating system, two ways to do so are by using the awk utility or with the Python programming language. E.g.,
ls -l example | awk '{sum +=$5} END
{print sum}'
. For a Python solution, you can use the
dirsize.py
program.
[ More Info ]