如何查找和执行与给定模式匹配的所有可执行文件的命令? [英] How do I locate and perform a command on all executable files matching a given pattern?

查看:266
本文介绍了如何查找和执行与给定模式匹配的所有可执行文件的命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我想找到在给定日期之前创建的所有 .doc 文件有任何可执行文件位设置,并且 chmod ax 它们。

解决方案



  find。 -name'* .doc'-perm +0111 -exec chmod a-x''{}''; 

这取决于可执行文件的含义。

How I identify all files on my Unix (OS X) system matching a particular pattern that have their executable bit set, so that I can perform a command on them?

For example, I'd like to locate all .doc files created before a given date that have any executable bit set, and chmod a-x them.

解决方案

Something like

find . -name '*.doc' -perm +0111 -exec chmod a-x ''{}'' ";"

It will depend on exactly what you mean by "executable".

这篇关于如何查找和执行与给定模式匹配的所有可执行文件的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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