I'm trying to run an sh file to move files around with scheduled tasks. See GUI pic. The result from "run Selected Task" is:

/tmp/tmp8yj5zs: line 1: /home/dan/Foscam/move-video.sh: Permission denied
Press ENTER to continue and close this window.

If I add sudo to the front I get:

 sudo: /home/dan/Foscam/move-video.sh: command not found
Press ENTER to continue and close this window.

The Sh file is

/usr/bin/find /home/foscam/FI9803P_C4D655404959/record/ -type f -mtime +3 -exec mv '{}' /home/dan/Foscam/Week_2/ \;
/usr/bin/find /home/dan/Foscam/Week_2/ -type f -mtime +3 -exec mv '{}' /home/dan/Foscam/Week_3/ \;
/usr/bin/find /home/dan/Foscam/Week_3/ -type f -mtime +3 -exec mv '{}' /home/dan/Foscam/Week_4/ \;
/usr/bin/find /home/dan/Foscam/Week_4/ -type f -mtime +3 -exec rm -f {} \;

Can anyone suggest what I'm doing wrong?

enter image description here

It does not seem like images is working for me so the command is home/dan/Foscam/move-video.shrun as Xapplication

#!/bin/sh at the top of the file seems to do the same.

  • 1
    running your script directly /home/dan/Foscam/move-video.sh is working? did you try adding bash to bash /home/dan/Foscam/move-video.sh in TASK command section? does the script is executable? Jul 28, 2017 at 5:08
  • It was executable but when I checked it was not so must have gotten changed during an edit. It now runs. It is nto doing what I wnat but at least now I can try and debug.
    – Dan
    Jul 28, 2017 at 19:22
  • 1
    Yes, also note that with your script you are just deleting everything in this path /home/foscam/FI9803P_C4D655404959/record/ in result!! be aware of this Jul 28, 2017 at 19:35
  • Probably you want it the other way round, first delete week4 dir, then move 3 to 4, move 2 to 3, move current to 2. Looks like a job for logrotate :) Feb 23, 2018 at 5:35

1 Answer 1


It has been a while but I did get it to work. At this point I don't quite remember how. I think I had issues with the file changing to a non executable. See below

/usr/bin/find /home/foscam/FI9803P_C4D655404959/record/ -type f -mtime +3 -exec mv '{}' /home/dan/Foscam/Week_2/ \;
/usr/bin/find /home/dan/Foscam/Week_2/ -type f -mtime +6 -exec mv '{}' /home/dan/Foscam/Week_3/ \;
/usr/bin/find /home/dan/Foscam/Week_3/ -type f -mtime +9 -exec mv '{}' /home/dan/Foscam/Week_4/ \;
/usr/bin/find /home/dan/Foscam/Week_4/ -type f -mtime +13 -exec rm -f {} \;

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.