I use rsync
as follows:
rsync -a –backup –suffix="."$(date +"%Y%m%d%H%M") source backups
to dump the whole of folder source into the folder backups, with the additional feature that if I modify some file foo in source, the old version of foo in backups will be renamed with a date suffix before the new foo is copied into backups.
This simple procedure does the job for me, only that I would like a deleted file to be renamed with the date suffix instead of being removed from backups. That is, if foo is deleted from source, then rename foo in backups with the date suffix.
I have tried to achieve this but so far no success. Any ideas?
Best Answer
Adding the
--backup-dir
option should do what you're looking for:e.g.
This would create backups of your files at /destination/versions
Source: https://linux.die.net/man/1/rsync