Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Using stat() to get the total size of files in a folder

by joshua (Pilgrim)
on May 24, 2002 at 04:18 UTC ( [id://168974]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $size = 0;
    opendir (FOO, "foo") or error_stuff();
    foreach (readdir(FOO)) {
        $size += (stat("foo/$_"))[7] unless /^\.\.?$/;
    }
    closedir (FOO);
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://168974]
Approved by samtregar
Front-paged by samtregar
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (None)
    As of 2024-04-25 01:03 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found