Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: looking for simple solution

by plaid (Chaplain)
on Jun 15, 2000 at 20:58 UTC ( #18321=note: print w/replies, xml ) Need Help??

in reply to looking for simple solution

I'm not quite sure what you mean by the size of a directory. If what you want is the actual byte size of the directory itself, you can just do
$size = (-s $directory);
If what you mean by size is the size of everything within it, you'll probably have to code something up by hand, preferably using File::Find to handle your recursion. I did a quick look on CPAN, but was unable to find any modules to handle disk usage.

If you do want the size of everything in the directory, and you're on unix, you can mess around with playing with the output of the system command 'du', but I don't recommend this for any script that will have a long life.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://18321]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2020-06-04 21:45 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (35 votes). Check out past polls.