replacing "grep" with "--glob-archives" when possible

better intergration with borg and better performances
This commit is contained in:
Djan 2023-09-13 10:32:42 +02:00
parent 994f8fdaef
commit 9e53a1f88b

View File

@ -149,7 +149,7 @@ function bobalstimes {
function bobagrepls { function bobagrepls {
TestBorgRepo TestBorgRepo
borg list --short ./ | grep $1 borg list --short --glob-archives "$1" ./
} }
function bobainfoa { function bobainfoa {
@ -376,7 +376,7 @@ function bobagrepdeleter {
borgrepo="${PWD##*/}" borgrepo="${PWD##*/}"
file="borgdelete_$borgrepo.sh" file="borgdelete_$borgrepo.sh"
borg list --short ./ | grep $1 >> $file borg list --short --glob-archives "$1" ./ >> $file
if [ "$?" != "0" ]; then echo "Error generating list of archives. Exiting." && rm $file && return;fi if [ "$?" != "0" ]; then echo "Error generating list of archives. Exiting." && rm $file && return;fi
sed -i 's/^/"/' $file sed -i 's/^/"/' $file
@ -447,7 +447,7 @@ function bobagreprenamer {
script="borgrenamer_$borgrepo.sh" script="borgrenamer_$borgrepo.sh"
echo "Generating list of archives..." echo "Generating list of archives..."
borg list --short . | grep "$1" >> $originals borg list --glob-archives "$1" --short . >> $originals
if [ "$?" != "0" ]; then echo "Error generating list of archives. Exiting." && return;fi if [ "$?" != "0" ]; then echo "Error generating list of archives. Exiting." && return;fi
cp $originals $file cp $originals $file
@ -484,7 +484,7 @@ function bobaextractallfiles {
mkdir -p $HOME/BorgExtract_"$BorgName"/;cd $HOME/BorgExtract_"$BorgName" mkdir -p $HOME/BorgExtract_"$BorgName"/;cd $HOME/BorgExtract_"$BorgName"
for ar in $(borg list --short $BORG_REPO);do for ar in $(borg list --short $BORG_REPO);do
path=$(borg list --format '{path}{NL}' ::$ar | grep -i "$1") path=$(borg list --glob-archives "$1" --format '{path}{NL}' ::$ar)
if [ $? = 0 ];then if [ $? = 0 ];then
mkdir -p $ar;cd $ar mkdir -p $ar;cd $ar
borg extract --list ::$ar $path borg extract --list ::$ar $path