Since $path stringifies to the path, it can be used as an argument in the move function of File::Copy:use Path::Class; my @dirs = qw/path to my directory/; my $path = my $dir = Path::Class::Dir->new(@dirs); $path->mkpath; #creates the directories as necessary
By using Path::Class and File::Copy you do not have to worry about what kind of directory separator to use and your script will be truly portable.use File::Copy; move('file_to_move', $path);
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re: problems moving files
by CountZero
in thread problems moving files
by smanicka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |