I have a directory
~/music that contains all my music files and a directory
/media/backup/music that I wish to synchronize with the first one using
rsync. Initially, I did a
rsync -a ~/music /media/backup which created the
music directory inside
/media/backup with all my music files as expected.
Since then I have modified a lot of filenames inside
~/music and now I want to sync these changes. Doing a
rsync -ain seems to register these modifications as new files - and hence it will create a set of new files in the backup directory and not just update the exisiting target filenames. Most of my files are big and I don't want to re-copy them each time they change name.
Is there a way to tell
rsync to synchronize identical files with different names by only updating the filenames from the source and not creating new ones? I might use the
--delete option to delete extraneous files, but if there's a better way to this I'd like to know.
$ cd example $ rsync -a var backup/ # rsync var under backup/var $ tree . . ├── backup │ └── var │ ├── JSON.gif │ └── logs │ ├── xinit.log │ └── x.log └── var ├── JSON.gif └── logs ├── xinit.log └── x.log $ mv var/JSON.gif var/JSON-LOGO.gif # rename some file $ mv var/logs var/log # rename some directory $ rsync -a var backup/ # sync the changes $ tree . . ├── backup │ └── var │ ├── JSON.gif # don't want this one │ ├── JSON-LOGO.gif # want -only- this one │ ├── log # same here │ │ ├── xinit.log │ │ └── x.log │ └── logs # don't want this one either │ ├── xinit.log │ └── x.log └── var ├── JSON-LOGO.gif └── log ├── xinit.log └── x.log