On Wed, Apr 04, 2001 at 05:37:17PM +0200, yevgeny wrote:
> I would like to get a total file size reporting for multy-level directory 
> structure, like right click-> Properties in Windows.
> 
> Note, i don't need a disk usage ( du -sk ), just total file size. 
> 
> wc -c gives me the total for files, not recursively drops into directories.
> 
> Is it correct to make a tar for the directory including all the levels and to 
> look at the tar file size ?

The tar output would also depend on its own format. That's not what
you want.


If the tree contains a really large number of files, or the file names
contain whitespace (but not newlines), you could

find . -type f -exec wc -c -- "{}" ";" | 
awk 'BEGIN { sum = "0" }; { sum = sum + $1 }; END { print sum }'


If it's just a regular tree of regular files, use the simpler

wc -c `find . -type f`

and consider the above monstrosity an evasive manouver to avoid
embarrassment by keen-eyed and quick-fingered UNIX shell gurus such as
Nadav, Moshe, or Oleg :)


        - Adi Stav

----------------------------------------------------------------------------
To unsubscribe, send a message to [EMAIL PROTECTED]
Archives available at http://www.mail-archive.com/[email protected]/

Reply via email to