Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

directory size

Status
Not open for further replies.

oinky

Programmer
Oct 29, 2001
45
US
Can someone please tell me how to get the size of a directory. The directory also have subfolders in it.
Thanks.
 
What do you mean by the "size" of a directory?

The number of files in the directory? Including subdirectories? Including files in subdirectories?

The number of bytes contained in all files in the directory? Including files in subdirectories?

The number of directory blocks taken up by the directory? And it's subdirectories? Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I need the size of the directory in bytes, including sub-directories and files. I was wondering if there was a way to get the total size of a dir without having to traverse to every file and sub-dir in that dir. If you know of some way it be much appreciated. 8)
 
If it's a directory's size in bytes(or Megs) you're after, then I can help you on Linux. Use the "du -sh" command like:

$ du -sh /tmp

to get the size of the /tmp directory. Here is what that command returns to me:

2.4M /tmp

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Is there a similar system command to that in NT? This program has to run on an NT machine 8(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top