1

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?

2 Answers2

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/*"
Rakib
  • 2,435
  • 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 –  Apr 17 '17 at 00:18