Copy latest backup, delete old backup

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

Moderator: Mr_Noodle

Copy latest backup, delete old backup Tue Jun 27, 2023 1:38 pm • by bayon
I have a piece of medical software that creates nightly backups, but the backsups have gotten so big that it is introducing some new problems in the way we used to manage things, so I am redoing everything.

What I would like to do is have Hazel copy the latest nightly backup to a folder on the desktop, and our backup software will only grab that folder. I also need Hazel to delete whatever backup was in that folder the night before, leaving me with one backup at any given time. The backups file that the software produces is a different name each time.

Currently I have a rule that is set to Date Added is Today, copy to Backups folder. This appears to be working well. What's the best rule to safely purge that folder of any old today and only leave the latest backup?
bayon
 
Posts: 18
Joined: Sun Oct 09, 2016 9:42 pm

Re: Copy latest backup, delete old backup Wed Jun 28, 2023 10:59 am • by Mr_Noodle
You can try "Date added is not among the X most recent" to match everything but the X most recent backups.
Mr_Noodle
Site Admin
 
Posts: 11262
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Copy latest backup, delete old backup Wed Jun 28, 2023 1:19 pm • by bayon
Thank you, I will give that a shot.
bayon
 
Posts: 18
Joined: Sun Oct 09, 2016 9:42 pm

Re: Copy latest backup, delete old backup Fri May 03, 2024 1:18 am • by pubay
Apologies for reviving an old post. I am trying to do something similar to the OP. A backup of a certain programme is created in a dedicated folder twice a day, and I would like the backups (which take the form of folders) older than two days to be automatically deleted. Initially I tried using “Date added is not in the last 2 days” to delete the older backups, but nothing happened. I then tried "Date added is not among the X most recent", but again nothing happens. How can I get this to work?
pubay
 
Posts: 2
Joined: Thu May 02, 2024 1:28 am

Re: Copy latest backup, delete old backup Fri May 03, 2024 12:28 pm • by Mr_Noodle
Can you go through the troubleshooting guide here? Post your results as well as the rule you are using.
Mr_Noodle
Site Admin
 
Posts: 11262
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Copy latest backup, delete old backup Fri May 03, 2024 4:07 pm • by pubay
I checked the Rule Preview and Rule Status, and everything seems to be in order. I also checked the log, and it says “matched” for everything. I'm afraid I can't figure out how to post a rule to this forum.
pubay
 
Posts: 2
Joined: Thu May 02, 2024 1:28 am


Return to Support