Move a file using shell script

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Move a file using shell script 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!!
RMeira
 
Posts: 15
Joined: Thu Apr 27, 2017 3:22 pm

Re: Move a file using shell script 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!!!
RMeira
 
Posts: 15
Joined: Thu Apr 27, 2017 3:22 pm

Re: Move a file using shell script 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.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron