adding bobarenamer
This commit is contained in:
parent
ab2410f7bc
commit
72e9716743
@ -122,3 +122,47 @@ function bobadeleter {
|
|||||||
sh $file
|
sh $file
|
||||||
rm $file
|
rm $file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# mass archive renaming
|
||||||
|
function bobarenamer {
|
||||||
|
TestBorgRepo
|
||||||
|
if [ "$TestBorgErr" = "1" ]; then return;fi
|
||||||
|
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 . >> $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/^/BORG_PASSPHRASE=\"\"\n/' $script
|
||||||
|
sed -i '1s/^/#Quick and dirty fix for repo with passphrase\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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user