Thinning out a backup folder

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Thinning out a backup folder Sun Sep 29, 2024 1:03 am • by Chq
Hello,

I use Hazel to regularly create backups of my accounting file. Hazel copies a new file into a backup folder for me every time I save it.

To stop the amount of data in this folder from constantly growing, I would like to thin out the data as follows:

Hazel should leave all backups created within the last 24 hours untouched.

From one day to one week, Hazel should leave the most recent daily backup in the folder and delete all the others.

From one week to one month, Hazel should leave the most recent weekly backup in the folder and delete all the others.

From one month, Hazel should leave the most recent monthly backup in the folder and delete all the others.

Is this even possible?
Chq
 
Posts: 15
Joined: Sat Sep 28, 2024 1:33 am

Re: Thinning out a backup folder Mon Sep 30, 2024 9:07 am • by Mr_Noodle
Look up nested conditions in the help. What you want to do is create a nested condition like:
Code: Select all
    If (all) are met for (current file)
        <whatever date conditions you need here, like "date create is not in the last 1 week" etc.>
        Date created is not among the 1 most recent


That should match any files that are not the most recent of whatever files match that first date condition. I suggest trying this out on some test files until you get it working as expected.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Thinning out a backup folder Mon Sep 30, 2024 12:46 pm • by Chq
Nice. Thank you for your hint.

Greetz Chris
Chq
 
Posts: 15
Joined: Sat Sep 28, 2024 1:33 am


Return to Support