adding bobagreprenamer
This commit is contained in:
parent
1cee71cc73
commit
bcdf2263ee
@ -33,6 +33,7 @@ bobalstimes List all archives with dates and times creation
|
||||
bobadeleter Mass archives deleting
|
||||
bobagrepdeleter Mass archives deleting with filter as argument
|
||||
bobarenamer Mass archives renaming
|
||||
bobagreprenamer Mass archives renaming with filter as argument
|
||||
bobaextractallfiles Extract all versions found of a file given in parameter
|
||||
bobacachedel Delete the cache dir of a repository (do not delete any archive)
|
||||
bobasecuritydel Delete the security folder from a repository (do not delete any archive)
|
||||
@ -71,6 +72,7 @@ bobalstimes Lister toutes les archives du dépôt avec les dates et heu
|
||||
bobadeleter Supprimer facilement plusieurs archives d'un dépôt
|
||||
bobagrepdeleter Supprimer facilement plusieurs archives d'un dépôt avec un filtre en argument
|
||||
bobarenamer Renommer en masses les archives d'un dépôt
|
||||
bobagreprenamer Renommer en masses les archives d'un dépôt avec un filtre en argument
|
||||
bobaextractallfiles Extraire toutes les versions d'un fichier donné en argument
|
||||
bobacachedel Supprimer le cache d'un dépôt (ne supprime aucune archive)
|
||||
bobasecuritydel Supprimer le dossier security d'un dépôt (ne supprime aucune archive)
|
||||
@ -490,6 +492,46 @@ function bobarenamer {
|
||||
rm $script
|
||||
}
|
||||
|
||||
function bobagreprenamer {
|
||||
TestBorgRepo
|
||||
which paste || echo "Paste command not found." exit
|
||||
|
||||
borgrepo="${PWD##*/}"
|
||||
file="file_$borgrepo.txt"
|
||||
originals="originals_$borgrepo.txt"
|
||||
script="borgrenamer_$borgrepo.sh"
|
||||
|
||||
echo "Generating list of archives..."
|
||||
borg list --short . | grep "$1" >> $originals
|
||||
if [ "$?" != "0" ]; then echo "Error generating list of archives. Exiting." && return;fi
|
||||
|
||||
cp $originals $file
|
||||
|
||||
$EDITOR $file
|
||||
sed -i 's/^/"/' $originals
|
||||
sed -i 's/$/"/' $originals
|
||||
sed -i 's/^/borg rename -v .::/' $originals
|
||||
|
||||
sed -i 's/^/"/' $file
|
||||
sed -i 's/$/"/' $file
|
||||
|
||||
paste -d" " $originals $file > $script
|
||||
|
||||
sed -i '1s/^/\n/' $script
|
||||
sed -i '1s/^/\n/' $script
|
||||
sed -i '1s/^/\n/' $script
|
||||
sed -i '1s/^/#Modifications in this file will be applied\, comment all to cancel\.\n/' $script
|
||||
sed -i '1s/^/### BORG RENAMER ###\n/' $script
|
||||
|
||||
$EDITOR $script
|
||||
|
||||
echo "Renaming..."
|
||||
sh $script
|
||||
rm $file
|
||||
rm $originals
|
||||
rm $script
|
||||
}
|
||||
|
||||
function bobaextractallfiles {
|
||||
TestBorgRepo
|
||||
export BORG_REPO=$(echo $PWD)
|
||||
|
Loading…
Reference in New Issue
Block a user