I want to search for a file on drive C:. I know for sure it does not exist in a specific directory(s) (say Program Files). So to shorten my search time, I want Windows to exclude searching in those specific folders. How can I perform such a search (which searches in the C drive but can skip specific folders)?
I would prefer the answer to be a method for Windows search, but am not opposed to it being a script or other simple program.
Best Answer
In line with user117893's answer and using the
dir
command in afor
loop. You can userobocopy
orxcopy
with the/L
(list only) option to search for files.Robocopy
Just specify the starting directory
C:\
and the target file name*File.txt
Output
xcopy
setup takes a couple extra steps.
exclude.txt
text file must be created which contains the keywords to exclude in the search.C:\
and the target file name*File.txt
exclude.txt
Commands
Output
Notes
The target is needed only to use the commands (
%Temp%
), nothing is actually copied due to/L
Both command took under a couple seconds to run with the listed exclusions.