I've tried multiple ways of writing this and I'm executing the script myself so it isn't the crontab that isn't working. These are examples of what I've tried :
find /home/backups -mtime +1 -exec rm {} \;
find /home/backups/* -mtime +1 -exec rm {} \;
find /home/backups/ -mtime +1 -exec rm {} \;
I need the files to get deleted every day yet it just seems to not work.
Running ls -ld /home/backups
returns a long file list - These are the first two files
-rw-r--r-- 1 root root 8284346 Jan 12 13:00 arksave-2016-01-12--01-00-01.tar.gz
-rw-r--r-- 1 root root 8295428 Jan 12 13:15 arksave-2016-01-12--01-15-01.tar.gz
Note that is more than one day old, and these are the last two files
-rw-r--r-- 1 root root 38016124 Jan 13 12:30 arksave-2016-01-13--12-30-01.tar.gz
-rw-r--r-- 1 root root 38016163 Jan 13 12:45 arksave-2016-01-13--12-45-01.tar.gz
ls -l /home/backups
andls -ld /home/backups
, and tell us which user is running the command. – EightBitTony Jan 13 '16 at 13:38find /home/backups/* -mtime +1
yet it prints nothing, even though im 100% sure at least ~3 of my files are older than a day. Ill edit the post with a bit of the output fromls -ld /home/backups
. Root should be running the command – Batzz Jan 13 '16 at 13:44$ find . -mmin +$((60*24))
– Batzz Jan 13 '16 at 13:50find . -mtime +0
as well. – TNW Jan 13 '16 at 13:51-mtime +0
for at least 1 day old (more than 0 day old). – Stéphane Chazelas Jan 13 '16 at 13:51