So I have automated backups setup for my machines, each with its own folder.
If you look in /mnt/tank/Backups/HTPC I have 4 files:
HTPC-01-01-2013.omg
HTPC-01-09-2013.omg
HTPC-01-20-2013.omg
HTPC-01-26-2013.omg
I have this situation for each of my machines and it's taking up quite a bit of space. I've searched Google and I can't find any script smart enough to recognize the 2 newest files and delete the older ones. I'd rather not have a script that deletes files older than a certain value because that could backfire if my machine is off for an extended period of time.
I tried googling and that was almost useless. I was thinking if I could make a script that slowly goes backwards in time from today until it finds 2 files, then auto-delete all files older than that threshhold that would work. But alas I'm not script-friendly enough to get it to work. Anyone know how I can do this? I was thinking something using find -atime +X would be useful..
If you look in /mnt/tank/Backups/HTPC I have 4 files:
HTPC-01-01-2013.omg
HTPC-01-09-2013.omg
HTPC-01-20-2013.omg
HTPC-01-26-2013.omg
I have this situation for each of my machines and it's taking up quite a bit of space. I've searched Google and I can't find any script smart enough to recognize the 2 newest files and delete the older ones. I'd rather not have a script that deletes files older than a certain value because that could backfire if my machine is off for an extended period of time.
I tried googling and that was almost useless. I was thinking if I could make a script that slowly goes backwards in time from today until it finds 2 files, then auto-delete all files older than that threshhold that would work. But alas I'm not script-friendly enough to get it to work. Anyone know how I can do this? I was thinking something using find -atime +X would be useful..