From a87a8dedf0d639d87265a527a242001f845af780 Mon Sep 17 00:00:00 2001 From: q Date: Wed, 12 Mar 2014 18:54:38 +0200 Subject: [PATCH] rmv fixing --- qcd_function | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qcd_function b/qcd_function index 3e9dc05..1ef7689 100644 --- a/qcd_function +++ b/qcd_function @@ -192,9 +192,11 @@ function rmv () { #mv with rsync local sources sources=() + # remove / from ends, if target is an existing folder for (( i=1; i<=$(($#-1)); i++ )) - do if [ -d "${!i}" ] + do if [ -d "${@: -1}" ] then sources+=("${!i%/}") + else sources+=("${!i}") fi done rsync -vaP --remove-source-files "${sources[@]}" "${@: -1}"