PowerTip: Use PowerShell to Find Folders that Match Pattern

Doctor Scripto

Summary: Learn how to use Windows PowerShell to find folders with names that match a specific pattern.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find the path to folders that have names that match a specific pattern?

Hey, Scripting Guy! Answer Use the Get-ChildItem cmdlet and the –Filter parameter with a pattern that matches the name, and then
           specify the  –Directory parameter. Here is an example that matches folders that have a four-letter name:

Get-ChildItem E:\Data\ScriptingGuys -filter "????" -Directory |

 % { $_.fullname }

0 comments

Discussion is closed.

Feedback usabilla icon