From 4628a7799d0108c76fe4d7342a56935a70b1ee5b Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 4 Dec 2023 12:51:51 +0300 Subject: [PATCH] Workability with spaces in filenames --- nnn/bin/_nnn-cp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nnn/bin/_nnn-cp b/nnn/bin/_nnn-cp index ca733b4..8a8a395 100755 --- a/nnn/bin/_nnn-cp +++ b/nnn/bin/_nnn-cp @@ -3,10 +3,11 @@ set -e sel=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} [[ -s $sel ]] -read -d $"\x00" -A tgts < $sel || : +tgts=$(xargs -0 -L1 < $sel) +tgts=(${(f)tgts}) size=$(du -A -c $tgts) size=(${=size}) size=${size[$#size - 1]} -for tgt ($tgts) ( cd $tgt:h ; tar cf - $tgt:t ) | +for tgt ($tgts) { pushd $tgt:h ; tar cf - $tgt:t ; popd } | pv --wait --interval 0.5 --size ${size}k | tar xf - --options read_concatenated_archives -- 2.44.0