Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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"'



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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2016-12-10 07:26 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (160 votes). Check out past polls.