Finally, I’ve found an optimal solution to backup my large mp3 collection (15.6 GB, 3775 songs, 10.25 days total playback time).
The problem: I continually update the mp3 tags, add new mp3 files, and move the directories around, etc., in the original collection. I keep a backup of the collection on a removable USB hard drive, and it takes forever to transfer the files over the USB1.1 link. These two copies of the collection, therefore, get out of sync, and it would be faster just to copy over the changed files rather than the entire collection to the backup device.
rsync -av --modify-window=1 --delete /media/AAA-music/ /removable-drive/AAA-music/
rsync compares the files in the first directory path with those in the second and determines which files need to be updated. Note that the trailing slash for the first directory path is necessary. The switch
--delete removes any files in the second path that are not found in the first. Thus you get an identical copy in the second location. The switch
--modify-window=1 gives a 1-second fudge factor in the comparison of the file modification dates, which is necessary because the dates in the VFAT file system in the second path aren’t as precise as in the first. Use the switch
-n for a dry-run of the command to test it out. No files will actually be written or deleted with this switch.
Also, note that since I am using
rsync to synchronize two directory paths on the same machine (as opposed to on two different machines over the network), it doesn’t use its synchronization algorithm to determine changes within a given file. It operates on whole files instead (comparing timestamps and file sizes). This is what I want here, because it would be very slow to read all the files on the USB drive, something I’m intending to avoid.