From fbfc925bbb9bee0b99ff7a6fb736c76e9906bd66 Mon Sep 17 00:00:00 2001 From: David Runge Date: Fri, 9 Dec 2022 23:15:04 +0100 Subject: Make rsync functions more readable .config/zsh/includes/functions.zsh: Change backupinfo() and backupfolder() to become more readable by using a local array for all options and using long names. --- .config/zsh/includes/functions.zsh | 79 +++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 31 deletions(-) (limited to '.config') diff --git a/.config/zsh/includes/functions.zsh b/.config/zsh/includes/functions.zsh index afe4915..9a9ca50 100644 --- a/.config/zsh/includes/functions.zsh +++ b/.config/zsh/includes/functions.zsh @@ -268,40 +268,57 @@ lstar() { ## RSYNC backupinfo() { - rsync\ - -r\ - -n\ - -t\ - -p\ - -o\ - -h\ - -g\ - -v\ - --progress\ - --delete\ - --ignore-existing\ - --size-only\ - -s\ - --exclude 'lost+found'\ - --exclude '.Trash-1000'\ - --exclude '$RECYCLEBIN'\ - --exclude 'System Volume Information'\ - --exclude '.thumbs'\ - $1 $2 - echo "backupfolder path/to/folder/ /path/to/other/folder" + local options=( + --delete + --dry-run + --exclude 'System Volume Information' + --exclude 'lost+found' + --exclude '.DS_Store' + --exclude '.Trash-*' + --exclude '.snapshots' + --exclude '.thumbs' + --exclude '$RECYCLEBIN' + --group + --human-readable + --ignore-existing + --owner + --perms + --progress + --recursive + --secluded-args + --size-only + --times + --verbose + ) + + rsync "${options[@]}" "$1" "$2" + echo "NOTE: path/to/folder/ /path/to/other/folder" } backupfolder() { - rsync \ - -r\ - -t\ - -p\ - -o\ - -h\ - -g\ - -v\ - --progress\ - --delete --ignore-existing --size-only -s --exclude 'lost+found' --exclude '.Trash-1000' --exclude '$RECYCLEBIN' --exclude 'System Volume Information' --exclude '.thumbs' $1 $2 + local options=( + --delete + --exclude 'System Volume Information' + --exclude 'lost+found' + --exclude '.DS_Store' + --exclude '.Trash-*' + --exclude '.snapshots' + --exclude '.thumbs' + --exclude '$RECYCLEBIN' + --group + --human-readable + --ignore-existing + --owner + --perms + --progress + --recursive + --secluded-args + --size-only + --times + --verbose + ) + + rsync "${options[@]}" "$1" "$2" } # journalctl -- cgit v1.2.3-54-g00ecf