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:

### I run this from the command line: /usr/bin/perl 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"); }


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?