From c42080fab4e7710681e4f816468f7a4f8f9c8f80 Mon Sep 17 00:00:00 2001 From: Q Date: Sun, 12 Nov 2023 20:26:49 +0200 Subject: [PATCH] test rsync copying (Again) --- files/cclip | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/files/cclip b/files/cclip index c56f2df..4ac0d6c 100755 --- a/files/cclip +++ b/files/cclip @@ -23,6 +23,7 @@ Paste files using clipboard: -l Use hardlink instead of file copying -k Keep clipboard link -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 Delete source files using clipboard links (WARNING): @@ -202,6 +203,7 @@ _paste() { if [[ "$1" =~ l ]]; then hardlink=1; fi if [[ "$1" =~ k ]]; then keeplink=1; fi if [[ "$1" =~ m ]]; then movelink=1; fi + if [[ "$1" =~ r ]]; then usersync=1; fi # parse switches for (( i=2; i<=$#; i++ )); do case ${!i} in @@ -209,6 +211,7 @@ _paste() { -l) hardlink=1; ;; -k) keeplink=1; ;; -m) movelink=1; ;; + -r) usersync=1; ;; *) if [[ ! -f "$STORAGE/${!i}" ]]; then # no such clipboard @@ -318,6 +321,11 @@ _paste_single() { return $? 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" if [[ -f "${1}" ]]; then if [[ $( stat -c "%s" "$1" ) -gt 100000000 ]]; then