How do I find all files that do *not* match a pattern? #13

Closed
opened 2025-12-30 12:47:01 +00:00 by jadudm · 1 comment
Owner

For example, I want to search a directory tree for everything that does not end in .json.

For example, I want to search a directory tree for everything that does *not* end in `.json`.
Author
Owner

Use the -not with find.

find . -not -name "*.json"

I used this to count the number of images (roughly) in a Google Takeout:

find . -not -name "*.json" | wc -l

Source: https://stackoverflow.com/a/1342110

Use the `-not` with `find`. ``` find . -not -name "*.json" ``` I used this to count the number of images (roughly) in a Google Takeout: ``` find . -not -name "*.json" | wc -l ``` Source: https://stackoverflow.com/a/1342110
jadudm added the bash label 2025-12-30 12:49:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jadudm/how-to-do-computer-things#13