Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: fast count files

by cdarke (Prior)
on Jan 06, 2012 at 11:10 UTC ( #946578=note: print w/replies, xml ) Need Help??


in reply to Re^3: fast count files
in thread fast count files

You might have issues using wc -l on Windows, unless you have installed it from somewhere like GNU. However it is easy to implement your own in Perl.
Based on BrowserUk's ideas:
use strict; use warnings; my $t=time; # $n = `attrib /s c:\\* | wc -l`; open (my $pipe, '-|', 'attrib /s c:\\*') or die "attrib: $!"; my $n = 0; while (<$pipe>) { $n++ } close $pipe; printf "$n : %.f\n", time()-$t;
Gives: 380366 : 135 on a used space of 297GB.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://946578]
help
Chatterbox?
[shmem]: Lady_Aleena: perl -MMP3::Tag -MFile::Find -le 'find(sub{if($File ::Find::name=~/\. mp3$/){$sum+=MP3:: Tag->new($_)-> interpolate("\%S ")} }, "Music"); print "total seconds: $sum"'
[Lady_Aleena]: shmem, sorry I was outside for a moment moving my car out of hubby's way.
[Lady_Aleena]: shmem, there is ONE song which throws a wrench in the works for both MP3::Info and MP3::Tag.
[shmem]: Lady_Aleena: fix it, or delete it ;-)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2017-04-23 22:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.