[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using wildcards to remove archives



On Thu, 2019-03-14 at 17:39 +0200, hvjunk wrote:
> Pull the whole list of archives, then grep for those you want, and do a multiple delete action: Beware, it could take easily an hour for large number of archives (In my case dailies) where I delete and leave weeklies/monthlies every 3-6months.
> 
> The “juice” part I use is GNU parallel which gets fed the list of archives (on the STDIN), one per line, ie:
> 
> cat LIST-TO-DELETE | parallel -j1 -X time tarsnap -v -v -v -d --keep-going -f{}
> 
> The important parts:
>  -X and the {} for -f of tarsnap to fill the list of archives to delete
> -j1 else you’ll have multiple tarsnaps competing and I recall the one working while the others exit with error
> 
> (I used the —keep-going for tarsnap, as I was using an “historical” list to prevent repeated requests, doing multiple delete runs over the list which then had already deleted archives and then tarsnap threw errors on those)


Thanks, but wow, that seems unnecessarily complicated and
time-consuming.

I think I'll stop naming my back-ups with a time stamp and just use a
date stamp, and then in my back-up script (which I run once daily) I'll
use "date" to calculate a date x days in the past and delete that single
archive. Since this machine isn't on 24/7 I'll have to manually remove
archives once in a while, but that's preferable to the current
situation.

In the meantime I'll write a short, one-time script to loop through a
manually compiled list of old archives I want to delete to get to where
I want to be with my archives.

Thanks for your suggestion.


Craig