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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

size of directory

Status
Not open for further replies.

buxtonicer1

Programmer
Sep 20, 2006
82
0
0
GB
Whats the easiest way to get the size of a directory in megabytes ?

The ls -l command gives you details of files in a directory, and details of a directory itself but not how much that directory and all the contents of it take up.
 
man du

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
du -h --max-depth=1

:)

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
du -ch /directory | grep total | awk '{print "Directory Size: "$1}'

Just a fancier way. Good luck.
 
or even:

du -ch DIRECTORY|tail -1

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top