diff --git a/qcd_function b/qcd_function index 165bb0c..9e987b0 100644 --- a/qcd_function +++ b/qcd_function @@ -190,7 +190,14 @@ function gcd() { function rmv () { #mv with rsync - rsync -vaP --remove-source-files "$@" + local sources + sources=() + for (( i=1; i<=$(($#-1)); i++ )) + do if [ -d "${!i}" ] + then sources+=("${!i%/}") + fi + done + rsync -vaP --remove-source-files "${sources[@]}" "${@: -1}" # remove empty folders from sources (not last argument) for (( i=1; i<=$(($#-1)); i++ )) do if [ -d "${!i}" ]