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?
Asked
Active
Viewed 2,337 times
1
tuskiomi
- 811
1 Answers
2
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.
DavidPostill
- 156,873
cmdanddir *.pro /syou will find the results you want, though maybe not in the format you might have wanted them. – AFH Jun 11 '17 at 22:22dirmatches both long and short file names, hence your result. You can disable 8.3 names or you can usefindstrto filter the results (as I now see David Postill has suggested in his answer). – AFH Jun 11 '17 at 22:53cmd, which is extended to give near-Unix scripting power, but more or less maintainscmdcompatibility for existing scripts; by default itsdircommand 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. – AFH Jun 12 '17 at 10:11dir *.txtbeing exactly the same asdir .txtso MS can't remove them from 64-bit cmd either. Moreover you don't need any replacement, powershell can do all of that and match Unix behavior. Simply abandon cmd altogether – phuclv Jun 12 '17 at 10:13cmduser TCC is a lot easier to learn than PowerShell. – AFH Jun 12 '17 at 10:18