Question

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.

Was it helpful?

Solution

There is no way to arbitrarily rename files with rsync. All rsync can do is move files to a different directory.

You must use a second tool either on the sending or receiving side to rename the files.

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top