title: How to write a list of directory trees to a text file?
body: <p>I want to create a batch file. When it is invoked as <code>batch.bat MyProject</code> or <code>batch.bat MyProject/</code> it will produce the following list. Note that <code>Dir</code> is a sub directory of <code>MyProject</code>. I am using Windows 7.</p>
  
  <pre><code>Dir
  Dir/SubDir1
  Dir/SubDir1/SubSubDir1
  Dir/SubDir1/SubSubDir2
  Dir/SubDir2
  Dir/SubDir2/SubSubDir1
  Dir/SubDir2/SubSubDir2
  Dir/SubDir2/SubSubDir3
  Dir/SubDir3
  Dir/SubDir4
  </code></pre>
  
  <p>How to write a list of directory trees to a text file?</p>
  
  <p>File names must be excluded.</p>