This is a simple script which sorts TV show episodes into the right folders, it comes down to this basic example:
### I run this from the command line:
/usr/bin/perl mover.pl The.Rookie.S05E14.720p.HEVC.x265-MeGusta[eztv.r
+e].mkv
The script dies here:
unless ( -e $ARGV[0] ) {
die("$ARGV[0] doesn't exist");
}
But:
- The file does exist: it shows up if I do ls The.Rookie.S05E14.720p.HEVC.x265-MeGusta[eztv.re].mkv
- The script is operating in the right folder, I double checked
If I skip the file-exists test and go right to moving the file to the correct folder, I can do this:
say "move command: 'mv $ARGV[0] ./r/'";
system("mv $ARGV[0] ./r/");
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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.