in reply to Re^3: Perl Permissions
in thread Perl Permissions
the directory$newlocation = "/perl/ass/$folder[$N]/$logfiles[$hour]";
doesn't exist.$newlocationdir = "/perl/ass/$folder[$N]";
You can use mkpath in File::Path (a standard module, so you should already have it on your system) to create it, just in case, before moving the file:
Note that there is no error checking for mkpath, because it may fail if the directory already exists. It doesn't matter. But the directory should exist after mkpath, so a test with -d "/perl/ass/$folder[$N]" would not be a bad idea.use File::Path 'mkpath'; use File::Copy 'move'; mkpath "/perl/ass/$folder[$N]"; move($oldlocation, $newlocation) or die "File cannot be moved: $!";
|
|---|