5

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.

2 Answers 2

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.

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .