AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  Calculate actual size of directory ?

    Posted Wed October 17, 2007 02:36 AM

    Originally posted by: Vilius


    Hi,
    As I remember I can calculate(file or directory) disk space occupied using du command, or I can get actual size of file using wc.
    But how do I get actual size of directory(and subdirectories and files) ?
    (wc only does that on files)

    thanks
    vilius
    #AIX-Forum


  • 2.  Think about what you really want to know.

    Posted Wed October 17, 2007 05:38 AM

    Originally posted by: nagger


    This depends on what you really want:

    wc is a dangerous tool as it will count the bytes in files.
    But the files are actually larger than the result from wc.
    A file with one byte takes up 4 KB of disk space as it requires a whole disk block.
    If you and 1000's of time files the difference between wc results and the actual disk use can be huge.

    I recommend: du -ks Directory-Name
    This will tell you the size including the wastage in KB's including the directory structures. This is the amount of space free you have to have to copy the directories and files to a different place. I suspect this is what you really want.

    hope this helps, N
    #AIX-Forum


  • 3.  Re: Think about what you really want to know.

    Posted Wed October 17, 2007 02:36 PM

    Originally posted by: Vilius


    Yes, I want to know information count of whole directory, not it's size on disk(although size on disk is more useful in most cases).
    Unfortunately command du -ks doesn't return any wastage numbers( maybe my AIX version is not up-to-date(v5.1) ).
    #AIX-Forum