Is there a tool or script I can use on a folder with a bunch of files. Files are added to this folder almost hourly. The tool should be "housekeeping":
-
Leave all files timestamped within the last 24 hours
-
Leave some (n) files that's a month old
-
Leave some (n) files that's an year old
-
Delete the rest
( n can be 1 for now for the sake of simplicity )
The idea is, when a data corruption/loss happens, I can go back to
-
a state (any available) from the last 24 hours
-
a state (if available) from 1 month ago
-
a state (if available) from 1 year ago
Best Answer
Expanding on the tip by Andrea, duplicity might be designed to address needs closer to mine. From http://duplicity.nongnu.org/duplicity.1.html (the last command looks promising):
Upate: Today I found this interesting article http://www.tarsnap.com/helper-scripts.html I believe what I'm trying to achieve is this https://en.wikipedia.org/wiki/Backup_rotation_scheme#Grandfather-father-son The article lists some tools. Update2: This script is interesting https://help.ubuntu.com/lts/serverguide/backups-shellscripts-rotation.html