![]() |
|
Just another Perl shrine | |
PerlMonks |
Why does system("mv $x $y") not work when it works at the command line?by Cody Fendant (Hermit) |
on Feb 03, 2023 at 01:18 UTC ( [id://11150107]=perlquestion: print w/replies, xml ) | Need Help?? |
Cody Fendant has asked for the wisdom of the Perl Monks concerning the following question: This is a simple script which sorts TV show episodes into the right folders, it comes down to this basic example:
The script dies here:
But:
If I skip the file-exists test and go right to moving the file to the correct folder, I can do this:
The mv command in the system() call fails with "No such file or directory", but the exact same command, if I copy and paste it from the perl script's output and hit enter, works just fine. Is it the brackets in the filename? I tried escaping them and it make no difference. The only wrinkle I can think of is that this is happening on MacOS, but the files in question are on a share from a Linux NAS, could that be causing issues?
Back to
Seekers of Perl Wisdom
|
|