http://www.perlmonks.org?node_id=15396

jrsmith has asked for the wisdom of the Perl Monks concerning the following question:

i have a script using File::Find to search for a file (obviously). my problem is when i pass a var, like this:
my $dir = "e:\/"; find(\&search_sub, $dir);
i get an error: Can't stat to e:/: No such file or directory. it wouldn't have anything to do with the fact that e:/ is a cd drive would it? i tried the same script using c:/ and it worked fine, and i have other scripts which access e:/ in the same way with no errors. also if i leave off the trailing slash i get the same error except it says permission denied, i've tried this as admin and gotten the same error (i'm on an NT system) and i am just lost... if anybody has any ideas i'd appreciate it

Replies are listed 'Best First'.
Re: can't stat to e:/:
by perlcgi (Hermit) on May 30, 2000 at 19:34 UTC
    You're nearly there. This will work with my cd on H:
    #!/usr/bin/perl use File::Find; my $dir = 'H:\\'; find(\&search_sub,$dir); sub search_sub { print if /^SETUP/i }
Re: can't stat to e:/:
by alyons (Initiate) on May 30, 2000 at 22:24 UTC
    have you tried using the UNC naming convention for the filesystem?
    like: \\H\ ? I'm not a windows user so that's my best guess.


    Adam Lyons
    Senior Systems Engineer
    Arzoo! Inc.
    alyons@arzoo.com
Re: can't stat to e:/:
by lolindrath (Scribe) on Aug 01, 2000 at 22:51 UTC
    I haven't tried it but do this:
    cd e:
    then stat /
    that might work

    --=Lolindrath=--
Re: can't stat to e:/:
by tye (Sage) on Aug 01, 2000 at 23:11 UTC

    As I recall, this was a bug fixed quite a while ago in Win32 Perl. So either upgrade your copy of Perl or use "e:/." instead of "e:/".

A reply falls below the community's threshold of quality. You may see it by logging in.