shrishinde
shrishinde

Reputation: 3405

Exclude specific file from find

I am trying to find all .py files under specific path except only one specific init.py file. Please note that I dont want to exclude other init.py files.

I tried find risk/bouncer/test/tt/ -name "*.py" ! -name __init__.py but it ignores all init.py files.

I want to ignore only __init__.py file from risk/bouncer/test/tt/ and all other files should be there.

Upvotes: 0

Views: 224

Answers (1)

anubhava
anubhava

Reputation: 785146

You can use -path option for this requirement:

find risk/bouncer/test/tt/ -name "*.py" -not -path risk/bouncer/test/tt/__init__.py

Upvotes: 1

Related Questions