Linux – Using rsync to rename files during copying with –files-from

bashlinuxrenamersync

Using rsync, how can I rename files when copying with the –files-from argument? I have about 190,000 files, each of which need to be renamed when copying from source to destination. I plan to have the list of files in a text file to pass to the –files-from argument.

Best Answer

Unfortunately I don't think rsync has any built-in renaming capability. The first workaround that comes to mind is that you could create a local mirror directory, with (renamed) symlinks to the actual data. Then you could use rsync on the mirror directory, adding the -L option ("transform symlink into referent file/dir"). You'd want to write a quick helper script to automate updating the mirrored structure, but it doesn't sound too scary.