Find command and reverse regular expression

I am looking for a way to express this command that excludes all executable perms, except for those files that end with ".EXE"

I am trying to solve it using the command "find" and -exec, please. Thank.

The command I tried and other versions of the same do not work:

find . -type f -regex "[^\.EXE$]" -printf "%f\n" -exec chmod a-x {} +

Thanks, help, Beco.


Edited by:

To find the "reverse" regex, I tried after (more) research:

find . -type f ! -regex ".EXE$" -printf "%f\n" -exec chmod a-x {} +

But that also didn't work.

+3
source share
2 answers

There are a few things that can be fixed with your team.

. "*.EXE", ! -name "*.EXE". OP , , \, ., E X.

, . -executable.

.

 find -executable -type f ! -name "*.EXE"  -exec chmod a-x {} +
+4

if find . -name "*.EXE" -exec chmod a-x {} + , ". -name.. -print" script script.

-1

All Articles