Page 1 of 1

Move a file using shell script

PostPosted: Fri Nov 23, 2018 3:37 pm
by RMeira
Hi, I need some help in a very simple rule. I don't know why my shell script doesn't work in a rule. It works fine and well on Terminal. It's a very simple command to move a file to a folder. I don't use Hazel move action because the folder name is different every year. This is my command:
/bin/mv $1 "/Volumes/XXXXX/YYYYY/TTTTT/RRRRR/FFFFF/YEAR$(date -v+1y +%Y)/Documents"

I've verified 1 million times and I don't know what's wrong!!!

Thanks in advance for your help!!

Re: Move a file using shell script

PostPosted: Fri Nov 23, 2018 5:34 pm
by RMeira
Solved. I just forgot Hazel needs to put $1 between quotation marks when filename has spaces on it. Thanks!!!

Re: Move a file using shell script

PostPosted: Mon Nov 26, 2018 12:49 pm
by Mr_Noodle
FYI, that's more of a shellscript thing. Most shells consider a space to separate arguments so you have to do something to handle arguments with spaces in them.