Код:

$TargetFolder="F:\ADB"
gci $TargetFolder | ? {$_.PsIsContainer -eq $true} | % {
$CurDir=$_.FullName
gci $CurDir | ? {$_.PsIsContainer -eq $false} | % {
$ShortCurDirName=Split-Path $CurDir -Leaf
$ShortCurDirName+"\"+$_.Name.ToString() | Out-File ($TargetFolder+"\"+$ShortCurDirName+".txt") -Encoding utf8 -Append
}
}