5
1
So I have a cron setup to make backups of a folder into a tarball every hour. I would like to add into the shell script that I'm using the ability to have files deleted automagically after about three days, so that I don't have a crap ton of files.
How can I go about this? Thanks.
So if I just add this in (changing the folder path), it'll delete anything older than three days? – Chiggins – 2011-01-21T17:15:03.627
Yes, but keep in mind it is recursive. If you have any folders beneath the backup folder, add the
-maxdepth 1
switch. – John T – 2011-01-21T17:17:07.860If you are at all unsure, add "echo " before the rm and verify the output first. – Chris Nava – 2011-01-21T17:20:39.127
@Chris good suggestion! – John T – 2011-01-21T17:25:44.117