M
Matt Garrish
After making a rather juvenile over-simplification in a previous thread, I
wrote a script out of pure curiosity to see how many extensionless files I
could find on my c:\ drive. I wrote the following simple code to do this:
### code start
use File::Find;
my ($ext, $noext);
find(\&wanted, 'c:/');
print "Files with extensions: $ext\nFiles without extensions: $noext\n";
sub wanted {
return if -d $File::Find::name;
($File::Find::name =~ /\.\w+$/) ? $ext += 1 : $noext += 1;
}
### code end
Which gave me the following obviously inaccurate results:
Files with extensions: 4811
Files without extensions: 236
I printed the filenames as it went and noticed quickly that it was skipping
all directories with spaces in the path (\program files\, etc.). I then
changed the invokation to the following:
find(\&wanted, 'c:\\');
And instead got the following
Files with extensions: 66954
Files without extensions: 1522
Is this a bug in File::Find? Or am I making an incorrect assumption about
how it works?
Matt
wrote a script out of pure curiosity to see how many extensionless files I
could find on my c:\ drive. I wrote the following simple code to do this:
### code start
use File::Find;
my ($ext, $noext);
find(\&wanted, 'c:/');
print "Files with extensions: $ext\nFiles without extensions: $noext\n";
sub wanted {
return if -d $File::Find::name;
($File::Find::name =~ /\.\w+$/) ? $ext += 1 : $noext += 1;
}
### code end
Which gave me the following obviously inaccurate results:
Files with extensions: 4811
Files without extensions: 236
I printed the filenames as it went and noticed quickly that it was skipping
all directories with spaces in the path (\program files\, etc.). I then
changed the invokation to the following:
find(\&wanted, 'c:\\');
And instead got the following
Files with extensions: 66954
Files without extensions: 1522
Is this a bug in File::Find? Or am I making an incorrect assumption about
how it works?
Matt