title: PowerShell: Subdirectory listing to a txt-file
body: <p>Today I started scripting in Windows PowerShell - so please excuse my "dumbness"...</p>
  
  <p>I want to create txt-Files with the name of the subfolders of each "rootfolder" on drive G:. On G:\ I have the following folders:</p>
  
  <p>1_data<br>
  2_IT_area<br>
  3_personal<br>
  4_apprenticeship<br>
  7_backup<br>
  8_archives<br>
  9_user_profile  </p>
  
  <p>So I wrote this script:</p>
  
  <pre><code>get-childitem G:\ | ForEach-Object -process {gci $_.fullName -R} | WHERE {$_.PSIsContainer} &gt; T:\listing\fileListing+$_.Name+.txt
  </code></pre>
  
  <p>But the script isn't doing what I want - it's creating only one text file.. can u help me? I already tried it as described here >> <a href="http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/" rel="nofollow">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/</a>  "T:\listing\$_.Name.txt" - doesn't work as well...</p>
  
  <p>Thank u very much for your Help!</p>
  
  <p>-Patrick</p>