From 54795d1f1bb147298c87fbda519405a873999216 Mon Sep 17 00:00:00 2001 From: q Date: Sun, 9 Feb 2014 11:45:18 +0200 Subject: [PATCH] rmv, mv with rsync --- qcd_function | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/qcd_function b/qcd_function index 7c9ee3a..a3d3b2a 100644 --- a/qcd_function +++ b/qcd_function @@ -179,3 +179,16 @@ function gcd() { } echo No match. } + +function rmv () { +#mv with rsync + local length + local sources + rsync -vaP --remove-source-files "$@" + # remove empty folders from sources (not last argument) + for (( i=1; i<=$(($#-1)); i++ )) + do if [ -d "${!i}" ] + then find "${!i}" -depth -type d -exec rmdir \{\} \; + fi + done +}