Commissario
Morning all,
One of my Raspberry Pis does an rsync backup of a specific directory to my NAS once a day. I only want to keep the thirty most recent directories.
Using find like this is all very good except that some of the files copied over have a modified date older than 31 days so boom, they get deleted.
Can anyone help please, I simply want to keep the most recent thirty folders in the backup location, anything else should be blitzed.
Thanks.
One of my Raspberry Pis does an rsync backup of a specific directory to my NAS once a day. I only want to keep the thirty most recent directories.
Using find like this is all very good except that some of the files copied over have a modified date older than 31 days so boom, they get deleted.
Code:
find /home/pi/spiderback/spider -type f -mtime +31 -exec rm -f {} \;
Can anyone help please, I simply want to keep the most recent thirty folders in the backup location, anything else should be blitzed.
Thanks.