1

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?

8
  • If you use cmd and dir *.pro /s you will find the results you want, though maybe not in the format you might have wanted them.
    – AFH
    Commented Jun 11, 2017 at 22:22
  • @AFH this search still yields .properties, .providers, and .project files.
    – tuskiomi
    Commented Jun 11, 2017 at 22:26
  • I'm sorry, you're right, and I've just realised why: Windows still insists on providing 8.3 names for long file names, including those with long extensions. Unfortunately all the name massaging is done in the 8-character part and the 3-character extension is the first 3 characters of the long extension. In its wisdom dir matches both long and short file names, hence your result. You can disable 8.3 names or you can use findstr to filter the results (as I now see David Postill has suggested in his answer).
    – AFH
    Commented Jun 11, 2017 at 22:53
  • @LưuVĩnhPhúc - Your links explain the mechanism, but not the reason for it, especially now that Windows 10 appears not to support 16-bit programs. There is another solution: TCC/LE is a replacement for cmd, which is extended to give near-Unix scripting power, but more or less maintains cmd compatibility for existing scripts; by default its dir 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.
    – AFH
    Commented Jun 12, 2017 at 10:11

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .