开发者

Windows command line search for exact extension with dir

When I do a search:

dir /b /s 开发者_如何学JAVA*.txt

I get all files/folders with the extension .txt. But I also get them when they have an extension like .txtx. How can I search for the exact extension?


you can try this

dir  /s /b *.txt | findstr /v .txt.

or

dir  /s /b *.txt | findstr /e .txt

or

dir  /b *.txt | findstr  .txt$


I can't figure out why it behaves like this, but this works: dir /b /s .txt | findstr /e .txt. Ugly but works.


dir C:\XML /s /b | findstr /e .xml > C:\XML\list.txt

this works for me, just change the .xml extension to .txt

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜