简体   繁体   English

复制大量文件xargs

[英]Copy large amout of files xargs

I'm trying to copy large amount of file from one directory to another using xargs command. 我正在尝试使用xargs命令将大量文件从一个目录复制到另一个目录。 But this one does not seems to work right. 但是,这一做法似乎行不通。

# echo * |xargs cp -r /directry/destination

what I am doing wrong? 我做错了什么?

Here is what it returns: 它返回的是:

cp: target `file name' is not a directory
find -maxdepth 1 -mindepth 1 -exec cp -r -t /directry/destination {} ';'

by default cp interprets the LAST argument as the target directory when there is more than one source directlry, but the way you have it, you have cp -r target source1 source2 source3... . 缺省情况下,当有多个源Directlry时,cp会将LAST参数解释为目标目录,但是通过这种方式,您可以使用cp -r target source1 source2 source3... So it is going to think you intend to copy things to the last source instead of the target. 因此,您会认为您打算将内容复制到最后一个源而不是目标。 If you are using gnu coreutils, you should have a -t or --target-directory switch so you can specify which directory you intend to use as the destination, so you could use echo * | xargs cp -r --target-directory /directory/destination 如果使用的是gnu coreutils,则应该使用-t--target-directory开关,以便可以指定要用作目标的目录,以便可以使用echo * | xargs cp -r --target-directory /directory/destination echo * | xargs cp -r --target-directory /directory/destination

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

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