directory size command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RomanRev
    New Member
    • Nov 2006
    • 1

    directory size command

    I am trying to figure out how to get the size of an entire directory. When I use:
    -s DIRECTORYHANDLE
    I always get zero. I am using this on Windows 2000/2003/XP with NTFS. ActivePerl 5.8.7
    I searched for hours for a clue. How do I do it?
  • miller
    Recognized Expert Top Contributor
    • Oct 2006
    • 1086

    #2
    You are probably not wanting the size of the directory, but the cummulative size of the contents.

    On windows, you can use the following OS specific module:
    http://search.cpan.org/~arich/Win32-DirSize-1.13/Win32/DirSize/DirSize.pm

    On any other system, you'll have to add up the contents yourself by opening the single directory level, or if you want a recursive size, then use File::Find.
    http://search.cpan.org/~nwclark/perl-5.8.8/lib/File/Find.pm

    Comment

    Working...