in reply to File Copy with Array
To amplify what has already been said:
use File::Path; use File::Copy; : : {mumble..mumble} much handwaving foreach my $line(@lines){ # flip the 0 to a 1 if you want verbose output # see text below for what 0755 means. mkpath([ "$pparent/$path/images" ],0,0755) if not -d "$pparent/$path/images"; copy ("$GraphicsDirectory/$line", "$pparent/$path/images/$line"); }
The 0755 in the mkpath can be changed to reflect the octal permissions you want the directory to have. If the directory does not exist that code will create the directory and the path leading to it if necessary. See the man pages for File::Path if you need more detail.
Two lines of code can make all the difference in the world.
|
|---|