From d5a7055f8544a093f07c1ba77957aa563a7d59f6 Mon Sep 17 00:00:00 2001 From: Djan <> Date: Mon, 25 Apr 2022 18:25:07 +0200 Subject: [PATCH] first version of bobaextractallfiles --- borgaliasandfunctions.txt | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/borgaliasandfunctions.txt b/borgaliasandfunctions.txt index 48f4295..896e6f4 100644 --- a/borgaliasandfunctions.txt +++ b/borgaliasandfunctions.txt @@ -1,4 +1,4 @@ -############################################################################### +############################################################################## # help functions ############################################################################### @@ -32,6 +32,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 +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) bobapassphrase Enter passphrase that will be used all env var by all borg repo in the same terminal @@ -68,6 +69,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 +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) bobapassphrase Entrer une phrase de passe en tant que variable d'environnement qui sera utilisé par les dépôts pour le terminal courant @@ -490,3 +492,21 @@ function bobarenamer { rm $originals rm $script } + +function bobaextractallfiles { + TestBorgRepo + if [ "$TestBorgErr" = "1" ]; then return;fi + export BORG_REPO=$(echo $PWD) + export BorgName=$(echo ${PWD##*/}) + mkdir -p $HOME/BorgExtract_"$BorgName"/;cd $HOME/BorgExtract_"$BorgName" + + for ar in $(borg list --short $BORG_REPO);do + path=$(borg list --format '{path}{NL}' ::$ar | grep -i "$1") + if [ $? = 0 ];then + mkdir -p $ar;cd $ar + borg extract --list ::$ar $path + cd .. + fi + done + cd $BORG_REPO +}