From 34b7d7dc67ae73ce6d90529297af3c58ed9e4125 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Tue, 7 Jul 2020 23:05:04 +0100 Subject: [PATCH] bin: update sortit --- bin/sortit.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/sortit.sh b/bin/sortit.sh index 533fb43..a25fef7 100755 --- a/bin/sortit.sh +++ b/bin/sortit.sh @@ -1,11 +1,19 @@ #!/bin/bash +# MV=$(which smv) +if [ "$MV" == "" ] ; then + MV="mv -i" +fi +echo "Using $MV to move files" function getsourcefiles() { local src=$1 unset i + i=0 + unset files while IFS= read -r -u3 -d $'\0' file; do files[i++]="$file" - done 3< <(ls "$src" | fzf -m --print0) + done 3< <(ls "$src" | fzf -m --tac --print0) + echo i $i if [ "$i" == "" ] ; then echo "You didn't choose any files." exit 1 @@ -36,7 +44,7 @@ while [ 1 == 1 ] ; do for i in "${files[@]}" do - # echo mv -i "$1/${i}" "$destpath" - mv -i "$1/${i}" "$destpath" + # echo $MV "$1/${i}" "$destpath" + $MV "$1/${i}" "$destpath" done done