How do I locate and perform a command on all executable files matching a given pattern?

筅森魡賤 提交于 2019-12-25 04:17:41

问题


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.


回答1:


Something like

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

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



来源:https://stackoverflow.com/questions/29922883/how-do-i-locate-and-perform-a-command-on-all-executable-files-matching-a-given-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!