rsync with backup and deletion

mucgyver-old
New Contributor III

Hi mates.

I have an rsync running with this command:

/usr/bin/rsync -avbz --no-p --no-g --chmod=ugo=rwX --update --delete --ignore-errors --force 
    --backup-dir="Deleted-$DATE" 
    --exclude='.*' --exclude='Applications' --exclude='Downloads' --exclude='Library' 
    --exclude='Movies' --exclude='Music' --exclude='Pictures' --exclude='Public'
    --exclude='Music' --progress --log-file="$log" 
    "/Users/$currentUser/" "/Volumes/$share/Backup/"

Basically does what it should do, like creating a Deleted-folder with current date suffix and move the stuff deleted on the source to there - so far so good.

However, when it runs next time, it would create a new Deleted-folder and move the previously created Deleted-folder within it, likely because this Deleted-folder is obviously not present on the source at all (as it never was, in this form). This "nesting" would multiply the needed storage with each run, which I would obviously like to prevent.

73d87413db144362bec4ac45988eb6c9

Is there any nice attribute I am currently not aware of to leave the existing Deleted-folders on the destination untouched, not copying them again and again to new Deleted-folders?

Hope my attempt to explain in conjunction with the screenshot attached makes it clear what my problem looks like...

Thanks and best regards,
Christian

1 ACCEPTED SOLUTION

mucgyver-old
New Contributor III

ryan.ball, I just found it out myself... had to exclude 'Deleted-*' as well, and it works like a charm. Thank you. :-)

View solution in original post

2 REPLIES 2

ryan_ball
Valued Contributor

@cbednarzwd What happens if you run it like this multiple times:

/usr/bin/rsync -avbz --no-p --no-g --chmod=ugo=rwX --update --delete --ignore-errors --force 
    --backup-dir='Deleted Previously' 
    --exclude='.*' --exclude='Applications' --exclude='Downloads' --exclude='Library' 
    --exclude='Movies' --exclude='Music' --exclude='Pictures' --exclude='Public'
    --exclude='Music' --progress --log-file="$log" 
    "/Users/$currentUser/" "/Volumes/$share/Backup/"

mucgyver-old
New Contributor III

ryan.ball, I just found it out myself... had to exclude 'Deleted-*' as well, and it works like a charm. Thank you. :-)