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
In reply to Re: Windows folder access error
by Lotus1
in thread Windows folder access error
by ArifS
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |