in reply to system(cp filenamewithspaces newplace/newname)
You didn't convert the file names into shell string literals when you created the shell command. There are two simpler alternatives:
You can use the multi-arg form of system which passes the arguments to the child without serializing them*:
system('cp', $oldname, "renamed/$newname") or die("cp: $!/$?\n");
You can use File::Copy:
copy($oldname, "renamed/$newname") or die("copy: $!\n");
* — Serialization will occur in Windows, but Perl will handle quoting and escaping for you (within the limits of Windows's command line abilities).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: system(cp filenamewithspaces newplace/newname)
by honeyeater (Initiate) on May 12, 2009 at 17:13 UTC |