adding bobadeleter

This commit is contained in:
Djan 2021-04-05 11:16:05 +02:00
parent 760c755111
commit ab2410f7bc

View File

@ -79,4 +79,46 @@ borggrep=$(borg list --short .::$borgarchive | grep $1)
echo "Chaine trouvé dans l'archive : $borgarchive" echo "Chaine trouvé dans l'archive : $borgarchive"
fi fi
done done
}
#Supprimmer en masse des archives dans un dépôt
function bobadeleter {
borgrepo="${PWD##*/}"
file="borgdelete_$borgrepo.sh"
editor="$EDITOR"
#test dépôt
borgrepofile="config"
if [ ! -f "$borgrepofile" ]; then
echo "Not in a borg repo. Unable to find $borgrepofile."
return
fi
borgrepofile="data"
if [ ! -d "$borgrepofile" ]; then
echo "Not in a borg repo. Unable to find $borgrepofile."
return
fi
#générer la liste des archives
borg list --short . >> $file
if [ "$?" != "0" ]; then
echo "Error."
return
fi
sed -i 's/^/"/' $file
sed -i 's/$/"/' $file
sed -i 's/^/#borg delete -v .::/' $file
clear
echo "### BORG DELETER ###"
echo ""
echo "Just uncomment lines you want to delete and save your file."
echo "Watch out you're doing, there won't be other confirmation."
sleep 5
$editor $file
sh $file
rm $file
} }