Adding function to delete old tarsnap archives.

This commit is contained in:
Faerbit 2015-11-13 10:58:20 +01:00
parent f0afd71eab
commit ed3854448f

View File

@ -83,3 +83,19 @@ pacman_disowned(){
virtual_env_prompt() {
REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) }
}
delete-old-archives() {
archives=$(sudo tarsnap --list-archives | sort)
del_archives=$(echo $archives | head -n $(($(echo $archives | wc -l) - 3)))
del_archives=("${(@f)del_archives}")
for archive in $del_archives
do
read -q "reply?Do you want to delete '$archive' ? "
echo ""
if [[ $reply == "y" ]]
then
echo "Deleting '$archive' ..."
sudo tarsnap -d -f "$archive"
fi
done
}