in reply to Windows folder access error
What operating system is this running on?
When I run your code with an invalid directory the message tells me "No such file or directory...". One way to get the message you show is if you don't have permission to open that directory. http://www.tek-tips.com/viewthread.cfm?qid=346695
use warnings; use strict; my $directory = "\\usr\\pm\\filefind1"; print "Folder: ", $directory; print -d $directory ? " found" : " not found", ".\n"; opendir (DIR, $directory) or die $!; while (my $fldr = readdir(DIR)) { print "$fldr\n"; } __END__ output: Folder: \usr\pm\filefind1 not found. No such file or directory at C:\usr\pm\filefind\1104870.pl line 8.
Updated to use $^E.
use warnings; use strict; my $directory = "\\usr\\pm\\filefind1"; print "Folder: ", $directory; print -d $directory ? " found" : " not found", ".\n"; ###### added $^E opendir (DIR, $directory) or die "$!\n***********\n$^E\n"; while (my $fldr = readdir(DIR)) { print "$fldr\n"; } __END__ output: Folder: \usr\pm\filefind1 not found. No such file or directory *********** The system cannot find the path specified
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Windows folder access error
by ArifS (Beadle) on Oct 24, 2014 at 20:05 UTC | |
by tye (Sage) on Oct 24, 2014 at 20:25 UTC | |
by Lotus1 (Vicar) on Oct 24, 2014 at 23:59 UTC | |
by tye (Sage) on Oct 25, 2014 at 01:23 UTC | |
by ArifS (Beadle) on Oct 24, 2014 at 20:36 UTC | |
by Lotus1 (Vicar) on Oct 25, 2014 at 00:07 UTC |