$CurrentFolder = "E:\Temp\jj"
Function GetSubFolder ($CurrentFolder) { $items = Get-ChildItem -Path $CurrentFolder Foreach ($item in $items) { If ($item.Mode -eq "d----") {GetSubFolder $item.pspath} Else { $item.Name $item.psparentpath } } }GetSubFolder $CurrentFolder