Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Missing files & File::Find.pm

by Thelonius (Priest)
on Feb 07, 2007 at 17:16 UTC ( #598821=note: print w/ replies, xml ) Need Help??


in reply to Missing files & File::Find.pm

Looking at the source code, it appears that the Windows Platform SDK defines PATH_MAX as 260, and that is more than 260 bytes long is going to cause problems.

The chdir() in the Microsoft C run-time always does a GetCurrentDirectory() after a SetCurrentDirectory() and it will fail if the absolute path name is more than 260 bytes, even if no single directory name is that large.

There might also be a bug in Perl or the C run-time so that a path name that large overwrites a buffer causing the file names to appear very weird (this is just speculation).

You might be able to get File::Find to work using the "no_chdir" option-- see the File::Find documentation.


Comment on Re: Missing files & File::Find.pm
Replies are listed 'Oldest First'.
Re^2: Missing files & File::Find.pm
by sbas013 (Initiate) on Feb 08, 2007 at 08:50 UTC
    Oh no - RTFM! I was a bit sceptical that I would get ANY replies thinking File::Find was just too boring for someone to show any interest. That's put me in my place.
    I will try the no_chdir option & see how I get on. If this doesn't work I will be forced to have a look at wsh / vb, what a shame!
    Thanks for the pointer, very much appreciated.
    Cheers,
    Simon
Re^2: Missing files & File::Find.pm
by Corion (Pope) on Feb 08, 2007 at 09:11 UTC

    Note that you can circumvent the PATH_MAX limit by using UNC filenames, as discussed in the CreateFile documentation by Microsoft. Some short testing shows that not changing the directory seems to work:

    perl -MFile::Find -le "for $d (@ARGV) {print qq(Scanning $d);find({no_ +chdir=>1, wanted=>sub{print $File::Find::name}},$d)}" \\?\Q:\ Q:\

    Without the no_chdir option, scanning the first entry (\\?\Q:\) fails immediately.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://598821]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2015-07-07 16:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (91 votes), past polls