Last active
December 12, 2015 02:38
-
-
Save sc68cal/4699799 to your computer and use it in GitHub Desktop.
Tarsnap archive pruner Usage: `tarsnap --list-archives | python cleanup.py | xargs -n1 tarsnap -df `
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
keep = {} | |
for line in sys.stdin.readlines(): | |
mountpoint = line.rfind("-") | |
if not line[:3] + line[mountpoint:] in keep: | |
keep[line[:3] + line[mountpoint:]] = line | |
else: | |
sys.stdout.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment