test rsync copying (Again)

This commit is contained in:
Q
2023-11-12 20:26:49 +02:00
parent 82fa8c2a2a
commit c42080fab4

View File

@@ -23,6 +23,7 @@ Paste files using clipboard:
-l Use hardlink instead of file copying -l Use hardlink instead of file copying
-k Keep clipboard link -k Keep clipboard link
-m Move instead of copy (can not be used with any other switch) -m Move instead of copy (can not be used with any other switch)
-r Use rsync to copy (verbose progress)
Shortcut to switches example: ${HL}$SELF plk${NO} equals -l and -k Shortcut to switches example: ${HL}$SELF plk${NO} equals -l and -k
Delete source files using clipboard links (WARNING): Delete source files using clipboard links (WARNING):
@@ -202,6 +203,7 @@ _paste() {
if [[ "$1" =~ l ]]; then hardlink=1; fi if [[ "$1" =~ l ]]; then hardlink=1; fi
if [[ "$1" =~ k ]]; then keeplink=1; fi if [[ "$1" =~ k ]]; then keeplink=1; fi
if [[ "$1" =~ m ]]; then movelink=1; fi if [[ "$1" =~ m ]]; then movelink=1; fi
if [[ "$1" =~ r ]]; then usersync=1; fi
# parse switches # parse switches
for (( i=2; i<=$#; i++ )); do for (( i=2; i<=$#; i++ )); do
case ${!i} in case ${!i} in
@@ -209,6 +211,7 @@ _paste() {
-l) hardlink=1; ;; -l) hardlink=1; ;;
-k) keeplink=1; ;; -k) keeplink=1; ;;
-m) movelink=1; ;; -m) movelink=1; ;;
-r) usersync=1; ;;
*) *)
if [[ ! -f "$STORAGE/${!i}" ]]; then if [[ ! -f "$STORAGE/${!i}" ]]; then
# no such clipboard # no such clipboard
@@ -318,6 +321,11 @@ _paste_single() {
return $? return $?
fi fi
if [[ "$usersync" = 1 ]]; then
echo rsync "${1} -> ${OUTPUT}/$target"
rsync -ElhprtvxP --info=progress2 --no-i-r "${1}" "${OUTPUT}/$target"
return $?
fi
echo Copying "${1} -> ${OUTPUT}/$target" echo Copying "${1} -> ${OUTPUT}/$target"
if [[ -f "${1}" ]]; then if [[ -f "${1}" ]]; then
if [[ $( stat -c "%s" "$1" ) -gt 100000000 ]]; then if [[ $( stat -c "%s" "$1" ) -gt 100000000 ]]; then