rmirror: Use rsync to mirror SOURCE to DEST

master
Pierre Neidhardt 2015-08-22 18:24:25 +02:00
parent 1c39e424ef
commit 6bf16e4257
3 changed files with 27 additions and 15 deletions

View File

@ -15,4 +15,4 @@ EOF
exit
fi
rsync -ivr --append-verify --progress -- "$@"
rsync -livr --append-verify --progress -- "$@"

26
.scripts/rmirror Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
opt_dry=""
if [ "$1" = "-n" ]; then
opt_dry="-n"
shift
fi
if [ "$1" = "-h" ] || [ $# -ne 2 ]; then
cat<<EOF
Usage: ${0##*/} SOURCE DEST
Use rsync to mirror SOURCE to DEST while showing progress and allowing resuming.
SOURCE does not need to be ending with a trailing slash. Only size is used for
comparison.
Options:
-n: Dry-run.
EOF
exit
fi
rsync "$opt_dry" -livr --size-only --delete-excluded --append-verify --progress -- "$1"/ "$2"

View File

@ -1,14 +0,0 @@
#!/bin/sh
if [ "$1" = "-h" ] || [ $# -ne 2 ]; then
cat<<EOF
Usage: ${0##*/} FOLDER1 FOLDER2
Dry-run of rsync over two folders.
EOF
exit
fi
rsync -nivr --size-only --delete-excluded "$1"/ "$2"