in reply to Re: fast count files
in thread fast count files
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: fast count files
by BrowserUk (Patriarch) on Jan 06, 2012 at 09:48 UTC | |
If you literally just want to count the files on the entire disk, this is by far the fastest simple method I know of. It counts the 1.2 million files on my cold-cache, 640GB (400GB used) drive in a little under 7 minutes:
Try it and see how you fare. I vaguely remember finding a faster method years ago, and I'll try to remember enough to look it up. Note: Don't do my @files = `attrib /s c:\\*`; my $n = scalar @files; All the memory allocation slows things down horribly. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
by cdarke (Prior) on Jan 06, 2012 at 11:10 UTC | |
Based on BrowserUk's ideas: Gives: 380366 : 135 on a used space of 297GB. | [reply] [d/l] [select] |
by gautamparimoo (Beadle) on Jan 06, 2012 at 11:23 UTC | |
Thanks for that quick reply But I have 2 use my @files = `attrib /s c:\\*`; my $n = scalar @files; as without it says that wc is an unrecognised command .Also the I am showing the code of the fastest method I know
suggest a faster method and also how to run without using my @files = `attrib /s c:\\*`; my $n = scalar @files; | [reply] [d/l] |
by BrowserUk (Patriarch) on Jan 06, 2012 at 12:19 UTC | |
But I have 2 use my @files = `attrib /s c:\\*`; my $n = scalar @files; I did warn you against loading the entire list into perl. It really slows things down. as without it says that wc is an unrecognised command There are various cures for that possible: But I remembered a faster method. This uses the Windows Script Host to do the donkey work via Win32::OLE and runs 3 times faster on my machine. 2:14 instead of 6:40 on my machine. It also counts the directries as it goes which may or may not be useful to you:
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
by gautamparimoo (Beadle) on Jan 06, 2012 at 12:30 UTC | |
by Sinistral (Monsignor) on Jan 06, 2012 at 13:44 UTC | |
by marto (Cardinal) on Jan 06, 2012 at 11:36 UTC | |
wc isn't shipped with Windows, you need to install it see gnuwin32 - coreutils. | [reply] |