- Create the data (e.g.: a text file) and leave it in my Linux desktop PC.
- When I feel that some of that data contains important information, I save it into the UPDATED disk. Also, I move the data into a folder called RECORDED (in my PC) just to know that I already saved it.
- Sometimes I like re-organizing my UPDATED hard disk so that things are easier to find or to make sure that folder names are coherent.
- Finally, from time to time (usually every few months) I synchronize the so-called OUTDATED hard disk so that it perfectly mirrors the UPDATED disk.
export UPDATED=/media/4BF0-F436_/
export OUTDATED=/media/4BF0-F236/
Next, run rsync in simulation (dry) mode in order to check which files will be deleted (or updated):
$ rsync -vanu --delete $UPDATED $OUTDATED | grep deleting
After making sure that everything is as you wanted, apply it for real:
$ rsync -vau --delete $UPDATED $OUTDATED
The options I am using here are:
- -v verbose mode
- -a archive mode (preserves owner, timestamps, etc)
- -u skip files that are newer in OUTDATED (if there were)
- -n dry-run (to try without doing)
- --delete deletes files from OUTDATED that are not in UPDATED
No comments:
Post a Comment