sudelb
October 24, 2021, 8:12pm
1
Basically I have a folder named "folder" that I back up weekly - it's content is changing from week to week.
I want to back this "folder" into a "backup" folder with a new name folder+date each week, rather than one backup on top of each other.
I also want to keep say 30 copies of these backup folders, and as the backup 31 is created, backup 1 should be deleted (the oldest).
How to use KBM to back up a new instance of the folder weekly?
1 Like
ccstone
October 25, 2021, 12:49am
2
Hey Boris,
Here's the basics.
Back Up a Folder With a Date-Stamp v1.00.kmmacros (5.9 KB)
This is pretty simple once you understand the pieces of the puzzle.
It's less simple to count the number of folders and delete the oldest one.
I'll come back to that if I have time.
-Chris
sudelb
October 25, 2021, 12:59am
3
Chris,
This is fantastic, thank you so much!
I’ve never used split path before - will need to look closely at its function.
Much appreciated,
B
rolian
October 25, 2021, 1:34am
4
Here's my approach to rolling off aging backups where I am keeping 3 backups - this probably gets a little unwieldy if you want to keep 30, but thought I'd put it out there because it is really just duplicating a bunch of actions and then adjusting the numbers:
Backup Hazel Rules Macro (v9.2)
Backup Hazel Rules.kmmacros (3.2 KB)
sudelb
October 25, 2021, 1:38am
5
Thank you Rob.
Interesting solution - you basically have one most recent and two previous copies at all times.
rolian
October 25, 2021, 1:44am
6
Yes, my approach exactly. For your specific request, another approach might be to take the folder where your dated backups are stored, and do:
For each dated folder, get creation date to a variable,
compare variable to a date 30 weeks ago, and
if date variable is greater than 30 weeks old (or however many weeks backups you are keeping), delete that dated folder.
sudelb
October 25, 2021, 12:46pm
7
Makes sense, thank you for your help!