X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=freeze-dir.sh;h=d8b249d98d31f70e2a9d61523d6615f28ca96167;hb=HEAD;hp=81f4a6d7a98ef635ca96ba188ac486e55f2555ed;hpb=caef54051c89be32e693aeed90fa915f621fce47;p=scripts.git diff --git a/freeze-dir.sh b/freeze-dir.sh index 81f4a6d..d8b249d 100755 --- a/freeze-dir.sh +++ b/freeze-dir.sh @@ -18,9 +18,9 @@ ######################################################################### # This command makes a backup copy of a given directory into a backup -# directory, tags it with the date and time, and uses rsync -# intelligent features to avoid making superfluous copies of files -# which are already backuped. +# directory, tags it with the date and time, and uses rsync smart use +# of hard links to avoid unnecessary duplicates of files already +# backuped. set -e @@ -61,18 +61,18 @@ while [[ "$1" ]]; do new_backup="${backup}:::${date}" if [[ -h "${current_backup}" ]]; then - rsync --link-dest="${current_backup}/" -axz "${full_path}/" "${new_backup}/" - rm -f "${current_backup}" + rsync --progress --link-dest="${current_backup}/" -axz "${full_path}/" "${new_backup}/" + rm "${current_backup}" else if [[ -a ${current_backup} ]]; then echo "${current_backup} exists and is not a symbolic link" >&2 exit 1 else - rsync -axz "${full_path}/" "${new_backup}/" + rsync --progress -axz "${full_path}/" "${new_backup}/" fi fi - ln -s "${new_backup}" "${current_backup}" + ln -vs "${new_backup}" "${current_backup}" sync