Skip to content

Instantly share code, notes, and snippets.

@jclement
Created April 1, 2014 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jclement/9916556 to your computer and use it in GitHub Desktop.
Save jclement/9916556 to your computer and use it in GitHub Desktop.
Really quick script to remove all but latest 60 backups with a given prefix from Tarsnap. Assumes archives have common prefix and a sortable suffix.
#!/bin/sh
for f in `tarsnap --list-archives | grep "^ARCHIVE_PREFIX_HERE_" | sort -r | tail -n+60`
do
echo "Removing $f"
tarsnap -d -f $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment