rmv, mv with rsync

This commit is contained in:
q
2014-02-09 11:45:18 +02:00
parent d53b70ded2
commit 54795d1f1b

View File

@@ -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
}