directory size - Unix

This is a discussion on directory size - Unix ; Hi Friends, How to find out a specified directory size on unix? Is there any direct method?...

+ Reply to Thread
Results 1 to 5 of 5

Thread: directory size

  1. directory size

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


  2. Re: directory size

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


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

    ?


  3. Re: directory size

    Neo 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

    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

  4. Re: directory size

    "Neo" 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.

  5. Re: directory size

    "Jens Thoms Toerring" wrote in message
    news:56cjtbF28ein1U1@mid.uni-berlin.de...
    > Neo wrote:
    >> How to find out a specified directory size on unix? Is there any
    >> direct method?

    >
    > 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


    Or, if you want to save two keystrokes,

    du -sk

    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)



+ Reply to Thread