From c68ec5388d16b5825acbd4de03fe2e58df642fff Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Sun, 9 Nov 2025 05:33:23 +0100 Subject: [PATCH] copyFiles_action: Refactor progress info --- lib/copy/action | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/lib/copy/action b/lib/copy/action index 63e7d75..f4d700d 100644 --- a/lib/copy/action +++ b/lib/copy/action @@ -1,6 +1,6 @@ #!/bin/bash copyFiles_action() { - (( cron )) || echo -n "Copying files... " + (( cron )) || echo -n $'Copying files...\033[K' echo ' SELECT source_files.filename, @@ -79,15 +79,29 @@ copyFiles_action() { fi fi fi - if cp -al "$sourcepath/$sourcefilename" "$destdir" 2>/dev/null\ - || cp -a "$sourcepath/$sourcefilename" "$destdir" + if cp -a --reflink=always \ + "$sourcepath/$sourcefilename" \ + "$destdir" \ + 2>/dev/null \ + || cp -al \ + "$sourcepath/$sourcefilename" \ + "$destdir" \ + 2>/dev/null \ + || cp -a \ + "$sourcepath/$sourcefilename" \ + "$destdir" then Update destination_files \ - filename "$destdir/${sourcefilename##*/}"\ - rename_pattern "${destinationrenamepath[$destination]}/${destinationrename[$destination]}"\ - fat32compat ${destinationfat32compat["$destination"]}\ - ascii ${destinationascii["$destination"]}\ - last_change $lastchange \ + filename \ + "$destdir/${sourcefilename##*/}"\ + rename_pattern \ + "${destinationrenamepath[$destination]}/${destinationrename[$destination]}"\ + fat32compat \ + ${destinationfat32compat["$destination"]}\ + ascii \ + ${destinationascii["$destination"]}\ + last_change \ + $lastchange \ <<-EOWhere id = $destfileid EOWhere @@ -98,12 +112,14 @@ copyFiles_action() { if (( count )) then (( cron )) || echo -n $'\r' - echo -n "Copied ${done:-0} of $count" \ + if (( count )) + then + echo -n "Copied ${done:-0} of $count" \ "files${postponed+ ($postponed postponed)}." (( cron )) || echo -en "\033[K" echo else - (( cron )) || echo -e "\rNothing to copy.\033[K" + (( cron )) || echo -n $'\r\033[K' fi unset count done }