What command do I use to find the size of all the files (recursively) in a Linux or Mac OS X directory?
The BSD version of
Here's an example.
This is the value with regular
Finally, you can use
This value matches exactly the number reported by Finder's Get Info window. (There are no weird forks or xattrs in this set of files.) It's significantly smaller than the value reported by
Here's how it works: it gets a list of all the files, and passes them to
The GNU version of
I combined all your approuches and combined it with a human readable output the result is:
Link to the gist: https://gist.github.com/mlegenhausen/9365461
du - tells the disk use not the file size.
above terminal code (im on osx 10.6) offers for me the best result and is waaay faster than "find ... -exec"
a quick benchmark
Show the size of a single file
Show the size of the contents of a directory, each sub-directory, and each individual file:
Show the size of the contents of a directory: