Justin Findlay wrote:
On Tue, Oct 12, 2004 at 11:18:33AM -0600, Harshwardhan Nagaonkar wrote:

Andrew Jorgensen wrote:

I'd like to find the total file size of a directory (with
sub-directories).  I can use 'du -s' except that I've been told that
'du' reports disk usage, which is not the same as file size.  'ls -l'
will tell me the actual size of a single file, but won't tell me the
sum of the sizes of files in a directory.

Am I going to have to write a script to do this seemingly simple task?

Thanks,

I've been doing this task using "du -h --max-depth=1" on my home directory to find out the sizes of each directory.


I always use 'du -h *' because it's shorter. (-:

<snip/>

Except that 'du -h *' will print out all the directories _as well as_ all the subdirectories and their subdirectories and their subdirectories and so on.

'--max-depth=1' will just limit to the current directory's children files/directories, not their sub directories. This way I guess you don't recurse everywhere! =)

--
Harshwardhan Nagaonkar
Brigham Young University
Provo, UT - 84604

____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to