Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 223
Mark Richman Avatar asked Aug 21 '09 14:08

Mark Richman


2 Answers

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
like image 134
user129070 Avatar answered Oct 16 '22 03:10

user129070


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.

like image 44
Aaron Digulla Avatar answered Oct 16 '22 05:10

Aaron Digulla