Using rsync to rename files during copying with --files-from?

Mark Richman picture Mark Richman · Aug 21, 2009 · Viewed 24.8k times · Source

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.

Answer

user129070 picture user129070 · Jun 21, 2013

Not entirely true... you CAN rename files enroute with rsync, but only if you rsync one file at a time, and set the --no-R --no-implied-dirs options, then explicitly set the destination name in the destination path.

But at that point, you may just want to use some other tool.

This, for example, would work:

rsync --no-R --no-implied-dirs
1.2.3.4::module/$FILENAME
/$PATH/$TOFILE/$NEWFILENAME