Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

cheers

thinker


Comment on Re: getting filesize in windows
Download Code
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 | http://chady.net/
      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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-12-26 03:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (164 votes), past polls