I am currently configuring crontab to delete all files and directories within the path shown every hour.
My current solution is two lines so I was hoping someone could show me how to make this into one line instead. At the moment, the second command removes the complete
directory as well. I would like to keep the complete
directory and only delete all directories within complete
.
What am I doing wrong? Should there be no slash after complete
? /*
?
To delete files older than 60 minutes in directory:
0 */1 * * * find /root/Downloads/complete/ -type f -mmin +60 -delete
To delete directories older than 60 minutes within directory:
0 */1 * * * find /root/Downloads/complete/ -type d -mmin +60 -exec rm -r "{}" \;