Cardbox > Support > Knowledge Base ...

Removing old backups from Amazon S3

You can set up your Cardbox Server to make regular backup copies of all its databases to Amazon S3: for more information, open the Cardbox Server Control and look at the Internet Backup page (hit F1 to see instructions once you've done this). You can choose the interval - hourly, daily, weekly, monthly, or a more complex schedule - and you can choose whether each backup replaces the previous one or whether old backups are retained when a new one is added.

If you do decide to retain old backups, then they will accumulate forever unless you do something about them. This article shows you a macro that you can use to delete all old backups, keeping only the most recent one of each file.

The text of the macro

When you put this macro into Cardbox, alter the first line to give the name of the Amazon bucket you have used for your backups.

Const BUCKET="yourbucketnamehere" Set amz=AmazonS3 list=Split(amz.ListFiles(BUCKET),vbCrLf) fname0="" StatusRange=UBound(list) n=0 For Each item in list StatusPosition=n : n=n+1 fullfname=Split(item,vbTab)(0) fname=Split(fullfname,Chr(1))(0) If fname = fname0 Then StatusText=fullfname0 amz.DeleteFile BUCKET,fullfname0 End If fname0=fname fullfname0=fullfname Next

© 2016 Martin Kochanski
"Cardbox" is a registered trademark.
 Top of page