0

This question already has an answer here:

Using find (specifically the one on windows that comes with git) to search files. I specifically want to check my entire USB drive but not in folders that start with a dot (specifically .git and .vs) and not in a folder called photos (many many vacation and bday pics, my file isn't in there).

How do I ignore those directories?

marked as duplicate by G-Man, don_crissti, Eric Renouf, Jeff Schaller, roaima Apr 16 '17 at 11:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1
find . -type d \( -name .git\* -o -name .vs\* -o name photos \) -prune -o -type f -print

The find command above will refrain from entering the said directories and for all other cases it will display the name of entities found that are regular files.

0

Use bellow command

find . \( ! -name .vs ! -name .git ! -name photos \)  -print

Where

. first is the current directory

You may change you location on your demand

Or you may use bellow command also

find .  -not -path "./.git/*" -not -path "./.vs/*" -not -path "./photos/*"
  • I tried on an actual linux distro. find . \( ! -name ".nuget" \) -print yields results from my .nuget directory however find . -not -path "*.nuget*" appears to work. I can't tell if find is searching the nuget directory or not. On windows it appears to do the same thing however using resource manager I see find is searching through the directory every tho it's not matching anything. There's a lot of files so its running slow which is what I'm trying to prevent. Maybe I should write a C# app. I was hoping this would be simple – user4069 Apr 17 '17 at 0:18