Using find with -exec {}, is there a way to count the total?

后端 未结 5 666
无人共我
无人共我 2020-12-29 18:48

I am using a command similar to this one:

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

Although, I am not using chmod, I am using a differ

5条回答
  •  温柔的废话
    2020-12-29 19:54

    This works:

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

    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.

提交回复
热议问题