From b92e814cf7231adcd08b39e75cc2729ec9ed6d1e Mon Sep 17 00:00:00 2001 From: locker98 Date: Sun, 9 Jun 2024 22:19:45 -0400 Subject: [PATCH] fix slow tar and added progress bar --- backup | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/backup b/backup index 077f808..507fb3a 100755 --- a/backup +++ b/backup @@ -32,18 +32,14 @@ echo "" echo -e "\e[0mStarting Backup" -tar -pcvf $BACKUP_LOCATION ./*.bak +SIZE=`python3 -c "print($(cat *.bak | tr '\n' '\0' | xargs -0 du -sk | cut -f 1 | tr '\n' '+')0)"` + +tar -cpT *.bak -f - 2>/dev/null | pv -p -s ${SIZE}k > $BACKUP_LOCATION -while read folder; do - # list the contents of each folder - echo -e "\e[32mBacking Up: $folder" - tar -r -p -f $BACKUP_LOCATION $folder &>/dev/null -done < *.bak echo "" - if [ "$COMPRESS" = true ]; then echo -e "\e[0mCompressing Backup"