简体   繁体   English

使用rsync在复制期间使用--files-from重命名文件?

[英]Using rsync to rename files during copying with --files-from?

Using rsync, how can I rename files when copying with the --files-from argument? 使用rsync,如何在使用--files-from参数进行复制时重命名文件? I have about 190,000 files, each of which need to be renamed when copying from source to destination. 我有大约190,000个文件,每个文件在从源复制到目标时都需要重命名。 I plan to have the list of files in a text file to pass to the --files-from argument. 我计划将文件列表放在文本文件中以传递给--files-from参数。

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. 不完全正确...您可以使用rsync重命名文件,但只有在一次rsync一个文件并设置--no-R --no-implied-dirs选项时,才显式设置目标名称目的地路径。

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

There is no way to arbitrarily rename files with rsync. 无法使用rsync任意重命名文件。 All rsync can do is move files to a different directory. 所有rsync都可以将文件移动到其他目录。

You must use a second tool either on the sending or receiving side to rename the files. 您必须在发送方或接收方使用第二个工具来重命名文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM