I'm trying to read the contents of a directory in a CGI script, like so:
$reportsDir =~ s#\s#\\\ #g; #escape whitespace in the path
$reportsDir = "/storage/$reportsDir";
opendir(REPORTDIR, "$reportsDir") or &error("Couldn't open $reportsDir
+: $!");
my @logFiles = grep /csv$/, readdir REPORTDIR;
closedir REPORTDIR;
This gives back a "no such file or directory" error when I run it as a CGI, but when I run it from the command line, it's fine. I've checked the permissions on the directory in question -- they're fine. Does anyone know what might be happening here?
| Alex Gottschalk Unix Systems Admin |
| <alexgo@netspace.org> Drink java, code Perl! |