解决方法错误“找到:缺少参数-exec'与发现-exec CP {} TARGET_DIR + [英] Solution to error 'find: missing argument to -exec' with find -exec cp {} TARGET_DIR +

查看:1573
本文介绍了解决方法错误“找到:缺少参数-exec'与发现-exec CP {} TARGET_DIR +的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正准备张贴此作为一个问题,但它周围的摆弄了一会儿后,我找到了解决办法。所以我想我会继续前进,在情况下,它可以帮助别人。

I was getting ready to post this as a question, but after fiddling around with it a little longer, I found the solution. So I thought I would go ahead and post it here in case it helps someone else.

我有找到-exec CMD +麻烦。我得到了错误:

I had trouble with find -exec cmd +. I got the error:

$ find ./ -name "*JIM*" -exec cp {} $TARGET_DIR +
find: missing argument to `-exec'

它的工作,如果我用

It worked if I used

$ find ./ -name "*JIM*" -exec cp {} $TARGET_DIR \;

但余did't想使用,因为它派生一个新的过程中找到的每个文件。

But I did't want to use that because it forks a new process for every file found.

和它的工作,如果我用

$ find ./ -name "*JIM*" -exec ls {} +

这列出了我要复制的文件。但 -exec CP {} $ TARGET_DIR + 没有工作。

我找到的解决方案是:

$ find ./ -name "*JIM*" -exec cp --target-directory=$TARGET_DIR {} +

其中, - 目标目录= 也可以使用 -t

希望这有助于。

推荐答案

在开头帖子中提到,我找到了解决的办法是:

As mentioned in the opening post, the solution I found is:

$ find ./ -name "*JIM*" -exec cp --target-directory=$TARGET_DIR {} +

其中, - 目标目录= 也可以使用 -t

这篇关于解决方法错误“找到:缺少参数-exec'与发现-exec CP {} TARGET_DIR +的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆