• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

使用找到-exec {},是有办法的总数

用户头像
it1352
帮助1

问题说明

我使用类似这样的命令:

I am using a command similar to this one:

find . -name "*.php" -exec chmod 755 {} \;

虽然,我没有使用chmod,我使用的是不同的命令,我不会在这里列出。此命令工作正常。但是,也有成千上万的文件和目录来进行操作,并且该操作需要花费一些时间。我想知道,如果有显示某种共有当操作完成的方法吗?也许是修改过的文件的计数?

Although, I am not using chmod, I am using a different command which I will not list here. This command is working fine. However, there are thousands of files and directories to be operated on, and this operation takes some time. I am wondering if there is a way to display some sort of total when the operation is complete? Perhaps a count of modified files?

我能想到的唯一的事情很简单,就是做这样的事情:

The only thing I can think of is simply to do something like:

find . -name "*.php" -exec chmod 755; echo " "; {} \;

请问这项工作?至少我们可以看到,事情正在发生...任何人有更好的建议?

Will that work? At least we can see that something is happening... Anyone have a better suggestion?

正确答案

#1

这个作品:

$ find . -name "*.php" -exec chmod 755 {} \; -exec /bin/echo {} \; | wc -l

您必须包括第二 -exec /斌/回声这个工作。如果找到命令没有输出,则厕所没有输入计数线。

You have to include a second -exec /bin/echo for this to work. If the find command has no output, then wc has no input to count lines for.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfjjfb
系列文章
更多 icon
同类精品
更多 icon
继续加载