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

Re: getting filesize in windows

by thinker (Parson)
on Aug 23, 2003 at 10:06 UTC ( #286038=note: print w/ replies, xml ) Need Help??

in reply to getting filesize in windows

Hi peamasii,

Here is a one liner that will look at all the files under your current directory, and sum the sizes of all files ending in mp3 (or Mp3 or MP3 etc)

The quotes may need changing for Window's though. I have no means of checking here, but it should be ok to insert into a script

perl -MFile::Find -le 'find ( sub { $s+= -s if /mp3$/i },  "." );print "size $s"'



Comment on Re: getting filesize in windows
Download Code
Replies are listed 'Best First'.
Re: Re: getting filesize in windows
by Chady (Priest) on Aug 23, 2003 at 10:41 UTC
    And since it's on windows, use this version:
    perl -MFile::Find -le "find ( sub { $s+= -s if /mp3$/i }, '.' );print +'size ',$s"

    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

    Chady |
      The sample worked. In fact I went back to doing this with File::Recurse because the rest of the code used that package. But File::Find essentially did the same recursive search. Thanks

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2015-11-27 17:13 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (731 votes), past polls