You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to to back up files without losing older versions ... one way to do that is the following:
rsync -avz --checksum --backup --backup-dir="older_versions" --suffix="~$(date +%Y-%m-%d)" "$SOURCE_DIR/" "$DEST_DIR/"
This moves the older file to an "older_versions" directory with a suffix consisting of the current date.
But what if one backs up more than once in one day? One could append the hour, minute and second as well, but a better way might be to append a UUID or hash (or the first 8 characters of one) to the backed up version.
Unfortunately rsync doesn't seem to have access to a file's checksum to use in naming (though it can use it to compare files) and it can't call uuidgen for each file. Something like the following only generates the uuid when rsync is called and then appends the same characters to every old version:
I want to to back up files without losing older versions ... one way to do that is the following:
rsync -avz --checksum --backup --backup-dir="older_versions" --suffix="~$(date +%Y-%m-%d)" "$SOURCE_DIR/" "$DEST_DIR/"
This moves the older file to an "older_versions" directory with a suffix consisting of the current date.
But what if one backs up more than once in one day? One could append the hour, minute and second as well, but a better way might be to append a UUID or hash (or the first 8 characters of one) to the backed up version.
Unfortunately rsync doesn't seem to have access to a file's checksum to use in naming (though it can use it to compare files) and it can't call uuidgen for each file. Something like the following only generates the uuid when rsync is called and then appends the same characters to every old version:
rsync -avz --checksum --backup --backup-dir="older_versions" --suffix="~$(date +%Y-%m-%d)-$(uuidgen | cut -c1-8)" "$SOURCE_DIR/" "$DEST_DIR/"
It would be great to have stronger versioning that allowed one to append different uuids to each old version file.
The text was updated successfully, but these errors were encountered: