How can I write a shell script that will delete files only from a folder that is older than 1 hour?
This is what I have so far:
find /path/to/folder -mtime +1 -exec rm {}\;
But this has 2 issues:
1. +1 is actually day not hour
2. when I run the script, I'm getting this error. find: -exec: no terminating ";" or "+"
I plan to run that through cron and I'm testing it from mac terminal.
Thanks,
Tee
Try this script
or
Use
-mmin
instead of-mtime
I would rewrite it to:
if your find does not support -delete use: