directory size
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > directory size




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    directory size  
Neo


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-21-07 12:24 PM

Hi Friends,
How to find out a specified directory size on unix? Is there any
direct method?






[ Post a follow-up to this message ]



    Re: directory size  
shakahshakah@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-21-07 12:24 PM

On Mar 21, 6:18 am, "Neo" <vikram.su...@gmail.com> wrote:
> Hi Friends,
>   How to find out a specified directory size on unix? Is there any
> direct method?

How about something like "du -k <directory name>", e.g.:
du -k /tmp
and
du -k /tmp | sort -n

?






[ Post a follow-up to this message ]



    Re: directory size  
Jens Thoms Toerring


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-21-07 12:24 PM

Neo <vikram.sutar@gmail.com> wrote:
>   How to find out a specified directory size on unix? Is there any
> direct method?

Your question isn't very clear: do you mean the size if the special
file for the directory or do you want the size of the contents of
the directory? And do you want to find out via a shell command or
do you need to figure out the size from e.g. a C program?

If it's the size of the contents of a directory (the size of the
file for a directory typically is only of small interest) and
you want to get it (in kB) with a shell command simply use

du -s -k <name of directory>

From a program (and if you satisfied with kB resolution) the
simplest method probably would be to invoke the above shell
command via popen() and simply read in the result.

Regards, Jens
--
\   Jens Thoms Toerring  ___      jt@toerring.de
\__________________________      http://toerring.de





[ Post a follow-up to this message ]



    Re: directory size  
SM Ryan


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-21-07 06:25 PM

"Neo" <vikram.sutar@gmail.com> wrote:
# Hi Friends,
#   How to find out a specified directory size on unix? Is there any
# direct method?

Is the directory size the number of bytes in the inode, the number
of linked files, or the cumulative size of child files?

--
SM Ryan http://www.rawbw.com/~wyrmwif/
Mention something out of a Charleton Heston movie, and suddenly
everybody's a theology scholar.





[ Post a follow-up to this message ]



    Re: directory size  
David T. Ashley


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-22-07 06:24 AM

"Jens Thoms Toerring" <jt@toerring.de> wrote in message
news:56cjtbF28ein1U1@mid.uni-berlin.de...
> Neo <vikram.sutar@gmail.com> wrote: 
>
> If it's the size of the contents of a directory (the size of the
> file for a directory typically is only of small interest) and
> you want to get it (in kB) with a shell command simply use
>
> du -s -k <name of directory>

Or, if you want to save two keystrokes,

du -sk <name of directory>

I'm not picky ... just that I often use the "du" command and have gotten
used to typing "du -sk".
--
David T. Ashley              (dta@e3ft.com)
http://www.e3ft.com          (Consulting Home Page)
http://www.dtashley.com      (Personal Home Page)
http://gpl.e3ft.com          (GPL Publications and Projects)







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:29 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register