in reply to how to copy files with spaces in name
problem is that file names with spaces cause this line to fail
Show your failing code. I suspect your directory reading code to cause the problem. Did you check that $groupFile actually holds the file name with embedded spaces? This works for me:
use File::Copy; use Cwd; my $file = 'foo bar'; my $dest = 'dest dir'; my $cwd = getcwd(); my $src = "$cwd/$file"; open my $fh, '>', $file or die "Can't write '$file': $!\n"; close $fh; mkdir $dest or die "Can't mkdir '$dest': $!\n"; copy ($src, $dest) or die "Can't copy '$src' to '$dest': $!\n";
Also, don't interpolate single variables. Don't say copy ("$groupFile","$errDir"), say copy ($groupFile, $errDir)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to copy files with spaces in name
by ric.techow (Initiate) on Mar 06, 2009 at 12:41 UTC | |
by shmem (Chancellor) on Mar 06, 2009 at 13:06 UTC |