I'm trying to search for a certain file extension, .pro. I have tried the following searches in the search bars: type:.pro
and *.pro
, however, both of these queries yield files with the extension .properties
and .project
. I don't want these in my results. how do I exclude these?
1 Answer
I'm trying to search for a certain file extension, .pro
I have tried the following searches in the search bars: type:.pro and *.pro, however, both of these queries yield files with the extension .properties and .project.
This is not possible using the Windows Explorer search bar, even when using Advanced Query Syntax.
However, it can be achieved in a cmd
shell, with the following command:
dir /b /s | findstr /e /l /c:".pro"
Example:
> dir /b /s *.pro
F:\test\.pro
F:\test\test.pro
F:\test\test.profile
F:\test\test.properties
F:\test\test.project
> dir /b /s | findstr /e /l /c:".pro"
F:\test\.pro
F:\test\test.pro
Further Reading
- An A-Z Index of the Windows CMD command line
- A categorized list of Windows CMD commands
- dir - Display a list of files and subfolders.
- findstr - Search for strings in files.
cmd
anddir *.pro /s
you will find the results you want, though maybe not in the format you might have wanted them.dir
matches both long and short file names, hence your result. You can disable 8.3 names or you can usefindstr
to filter the results (as I now see David Postill has suggested in his answer).cmd
, which is extended to give near-Unix scripting power, but more or less maintainscmd
compatibility for existing scripts; by default itsdir
command does not match 8.3 names, though there is an option to allow this. TCC/LE is free for non-commercial use, and is a slightly stripped-down version of the even more powerful TCC.