Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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
Domain Nodelet?
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 taking refuge in the Monastery: (2)
As of 2021-09-19 01:21 GMT
Find Nodes?
    Voting Booth?

    No recent polls found