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.
Asked
Active
Viewed 6,873 times
2 Answers
6
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.

Cascabel
- 288
- 2
- 9
3
If your rename would consist of merely adding a suffix to the existing name, then you might be able to use the --backup
and --suffix
options to rsync
.

Dennis Williamson
- 62,149
- 16
- 116
- 151