Closed dcastil closed 5 years ago
@dcastil Where is your copy trash
located?
rm
is in /bin/rm
which would be in the path of a shell script run by LaunchAgent
, but trash
probably isn't. You'll need to include the path to trash
in ~/script.sh
or put trash
somewhere on the default path.
That makes sense, thanks for the explanation! I just didn't think that the context of execution would be different from the terminal.
Hi @ali-rantakari!
I try to set up a script which moves old files in a specific directory into the trash every day and found out that the
trash
command isn't working when started from the LaunchAgent.So when creating a file in
~/Library/Launchagents
with following contentand a file
~/script.sh
with following contentand then load the LaunchAgent with
only
test1
gets deleted and nottest2
. Do you know what's the reason for that? I couldn't find out why it's not working.Thanks!