Getting sub folders by name with windows cmd

Within a batch-script, I would like to list all subfolders with a given name. I can do it in general but have problems, when there is subfolder direclty in the folder where I am searching. I am doing this on Windows 7 cmd.

Code I use to list all subfolders with name bin:

dir /s /q /b /A:D bin

If I have a folder structure like this: ".\a\bin .\b\bin .\c\bin" it works fine.

if I have structure like this: ".\bin .\a\bin .\b\bin .\c\bin" it only lists the content of ".\bin".

Does anybody know any workarounds?


dir /s /b /A:D *|findstr /ri "[\\]bin$"

Need Your Help

Directive does not run link function when attribute changes value

jquery angularjs angularjs-directive qtip2

I have created a directive for encapsulating qTip2 library into my angular application (as described in another SO question) . I have a dictionary with different configurations for qTip and dependi...

GSEventLockDevice couldn't Lock phone properly

iphone ios

I locked the iPhone by calling the method GSEventLockDevice()from GraphicsServices.framework. It's working fine on the iPhone , but after locking the phone the backlight doesn't turn off. It remain...