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.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.


In reply to Re: Find::File error by BrowserUk
in thread Find::File error by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.