使用找到-exec {},是有办法的总数? [英] Using find with -exec {}, is there a way to count the total?
问题描述
我使用类似这样的命令:
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?
推荐答案
这个作品:
$ 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.
这篇关于使用找到-exec {},是有办法的总数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!