in reply to Bugs in File::Find on Windows

The obvious workaround (untested) should be:
use Cwd 'chdir';# Explicitly export Cwd::chdir (will maintain $ENV{PW +D} ) my $dir = getcwd();#exported from Cwd by default use File::Find; find( \&wanted, "C:" ); chdir $dir; my @st = stat "C:bar.txt";
But you say you don't want to do that. Is &wanted doing any directory traversal itself? If it is, I'd suggest making sure you're using the Cwd version of chdir, else perl may have a hard time keeping track of where it is. -Greg

Replies are listed 'Best First'.
Re^2: Bugs in File::Find on Windows
by jdporter (Paladin) on Feb 16, 2007 at 00:14 UTC

    Thanks. But that won't solve the problem, because getcwd() only tells you the cwd of the current drive, not of any of the other drives.

      getdcwd('C:');


      ___________
      Eric Hodges

        Perfect!

        O.k., that's half the solution. Is there a symmetric "chddir" as well? chdir doesn't seem to do it.

        A word spoken in Mind will reach its own level, in the objective world, by its own weight