Reputation: 1569
Would please anyone tell how I can get the path of a specific folder with Powershell command that is about 10, 15 places down in folder structure.
E.g. In the following folder structure
C:\Folder1\Folder2\Folder3\...\....\....\....\....\.....\....\....\...\MyFolder
Here I have the starting folder path accessible i-e.
C:\Folder1\Folder2\Folder3\
but I don't know the missing ...\...\....\
folders.
I want to get the full path to the MyFolder. Any help doing that with Powershell?
Upvotes: 0
Views: 321
Reputation: 3923
Try this:
get-childitem -Path 'c:\Folder1' -Directory -Recurse | ? {$_.Basename -eq 'MyFolder'} | Select FullName
Or:
get-childitem -Path 'C:\folder1' -Directory -Recurse -Filter 'MyFolder' | Select FullName
Upvotes: 3