in reply to Find::File error
You don't have permission to read the 'System Volume Information' folder, so when File::Find attempts to use opendir on it, the attempt fails, so it does
warnings::warnif "Can't opendir($dir_name): $!\n";
The "Invalid parameter" is the contents of $! as set by the perl core code for opendir. It apparently assumes that the only reason you wouldn't be able to open a directory is if you supplied a bad, non-existant or malformed directory name. Ie. An invalid parameter.
However, if you print $^E, immediatly after a failed opendir attempt, then you will usually get a little more specific information from the OS about why the attempt failed. In this case, "Access denied"
P:\test>perl -Mstrict -wl opendir D, 'c://System Volume Information' or warn $!,$/, 'OS reports: +', $^E; print while $_=readdir(D); close D; ^Z Invalid argument OS reports:Access is denied at - line 1.
I guess a patch to File::Find to use $^E under Win32 would be a nice idea.
Till then, if you wish to suppress these warnings for directories and files for which you don't have access, you can turn off the warnings, locally, for the duration of the find().
P:\test>perl -MFile::Find -Mstrict -wl { local $^W; find( sub{ print; }, 'c:/System Volume Information' ); } ^Z .
You could maybe find a no warnings '???'; setting that would be less all encompassing.
|
|---|