【问题标题】:Issues with large directory and cp command大目录和 cp 命令的问题
【发布时间】:2009-08-19 14:27:07
【问题描述】:

我正在尝试将所有 jpg 从 1 个目录复制到另一个目录,但只复制新文件和已更新的文件。

我正在使用以下命令:

\cp -uf /home/ftpuser1/public_html/ftparea/*.jpg /home/ftpuser2/public_html/ftparea/

我得到了错误:

-bash: /bin/cp: Argument list too long

我假设这个目录中有 2 个文件供 cp 命令工作

我也试过了:

find  /home/ftpuser1/public_html/ftparea/ -name "*jpg" -exec cp -uf {} /home/ftpuser2/public_html/ftparea/

得到以下结果:

find: missing argument to `-exec'

有什么想法吗?

【问题讨论】:

  • 您忘记了find 命令末尾的\; 参数,这就是它不起作用的原因。

标签: linux bash command-line centos


【解决方案1】:

您需要确保包含最后的“\;”以完成-exec 应该执行的命令。

【讨论】:

    【解决方案2】:

    使用 find 您不应该在引号中加上括号。试试这个

    find  /home/ftpuser1/public_html/ftparea/ -name "*jpg" -exec cp -uf {} /home/ftpuser2/public_html/ftparea/ \;
    

    【讨论】:

      猜你喜欢
      • 2013-12-05
      • 2016-08-11
      • 2021-05-31
      • 2012-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多