title: Windows Batch File - Display All Folder & Sub-Folder relative paths
body: <p>I am trying to have a batch file output ONLY the short-name of folders and sub-folders to a file. However, with the example below I am only able to get the fullpath.</p>
  
  <pre><code>DIR /S /B /O:N /A:D &gt; FolderList.txt
  </code></pre>
  
  <p>Which will output:</p>
  
  <pre><code>X:\Example\Folder 1
  X:\Example\Folder 2
  X:\Example\Folder 3
  X:\Example\Folder 1\Sub-Folder 1
  X:\Example\Folder 1\Sub-Folder 2
  X:\Example\Folder 2\Sub-Folder 1
  </code></pre>
  
  <p>When the desired output is:</p>
  
  <pre><code>Folder 1
  Folder 2
  Folder 3
  Folder 1\Sub-Folder 1
  Folder 1\Sub-Folder 2
  Folder 2\Sub-Folder 1
  </code></pre>
  
  <p>The issue comes with the <code>/S</code> switch that allows the <code>DIR</code> command to recurse into sub-folders.</p>
  
  <p>Is there a simple way, using only a Windows Batch File, to output a list of folders and sub-folders in the current directory to a text file?</p>