]> lifelog.hopto.org Git - wb-shell-scripts.git/commitdiff
fix: upd. for ls to use the -t flag.
authorWill Budic <redacted>
Sun, 15 Feb 2026 09:51:37 +0000 (20:51 +1100)
committerWill Budic <redacted>
Sun, 15 Feb 2026 09:51:37 +0000 (20:51 +1100)
linux-B_L_R_via_sshfs/list.sh

index 4ae89dde1cd2ee8c93caf4ebae770601c496eb0c..a01a825aed9b8e235d57633a6026f3bc46d1bdb8 100755 (executable)
@@ -13,12 +13,12 @@ echo -e " This is an backup archive restore list creator, use this program from
 echo -e " Backup location is DEST_SERVER='$DEST_SERVER'"
 echo -e " Restore location is PWD='`pwd`'"
 echo -e "--------------------------------------------------------------------------------------------------------------"
-echo -e "Syntax: $0 {-target=/some/path} {-keep} {restore.lst}\n"
+echo -e "Syntax: $0 {{-target=/some/path} {--tar} | {restore.lst}\n}"
 echo "After listing, to restore from the backup, use the list with the restore shell script."
 echo "Like: $SRC_DIR/restore.sh ./restore.lst"
 echo "To restore from a local drive or mount:"
 echo "$SRC_DIR/restore.sh --target=/mnt/$user/samsung  ./restore.lst"
-echo -e "Usage: $0 -keep - With -keep option so an previously created default named restore.lst will not be deleted.\n" 
+echo -e "Usage: $0 --tar   - Instruction to generate and text tar listing from latest archive. In text format to be viewed.\n" 
 [[ "$1" == '-?' || "$1" == '-h' ]] && exit;
 
 echo -e "Processing from config: $CONFIG_FILE"
@@ -48,24 +48,21 @@ fi
 
 if [[ ! -z "$1" && "$1" == "--tar" ]] 
 then
- BACKUP_FILE=$(ls $TARGET/$THIS_MACHINE-*.$EXT_ENC|tail -n 1)
+ BACKUP_FILE=$(ls -t $TARGET/$THIS_MACHINE-*.$EXT_ENC | head -n 1)
+ echo -e "Backup: $BACKUP_FILE\n"
  gpg --decrypt --batch --passphrase $GPG_PASS $BACKUP_FILE | pv -N "Status" -pw 80 | tar -Jtv \
  > "$BACKUP_FILE.list"
- echo -e "Tar list of -> $BACKUP_FILE\n"
+ echo -e "Crated tar list of -> $BACKUP_FILE\n"
  exit
 fi
 
-INDEX=$(ls -lh $TARGET/$THIS_MACHINE-*.$EXT_LST |sort -r|head -n 1);
+INDEX=$(ls -lht $TARGET/$THIS_MACHINE-*.$EXT_LST | head -n 1);
 if [[ -z $INDEX ]]
 then
 echo -e "FAILED to access target backup directory!\n"
 exit 0
 fi
 
-
-
-
-
 INDEX_FILE=$(echo "$INDEX" | awk '{print $9}')
 echo -e "Listing $INDEX_FILE\n"
 sel=$(xzcat "$INDEX_FILE" | sort -f -u | fzf --multi --header "Listing: $INDEX Config: $CONFIG_FILE")
@@ -81,10 +78,10 @@ done
 echo -e "Restore list contents check:"
 
 # Following is an good example why uvars are needed, bash can only forward $variables to spawn shells global variables.
-# This is what we are doing with the following statment. Or we could write this whole and other scripts in perl? :)
+# This is what we are doing with the following statement. Or we could write this whole and other scripts in perl? :)
 cat restore.lst | sort -u | while read n
 do 
-      #Display exisiting directory if selected.
+      #Display existing directory if selected.
       if [[ -d ~/$n ]]
       then
             echo -e "-------------------------------"            
@@ -100,10 +97,11 @@ done
 if [[ $(~/uvar.sh -s /var/tmp -r "BCK_LST_CHK") -eq 1 ]]
 then 
 echo -e "Warning - existing directories that have been found and listed above." \
-"\n During an restore are not synched, this will overwite existing local files or leave unneeded files."
+"\n During an restore are not synched, this will overwrite existing local files or leave unneeded files."
 ~/uvar.sh -d "BCK_LST_CHK" > /dev/null
 fi
 
 exit
-# This script originated from https://github.com/wbudic/B_L_R_via_sshfs
-# Required uvar.sh be installed in home directory, located at: https://github.com/wbudic/wb-shell-scripts
\ No newline at end of file
+# This script originated from : https://lifelog.hopto.org/gitweb/?p=wb-shell-scripts.git
+# older versions https://github.com/wbudic/B_L_R_via_sshfs
+