title: How to auto create folder based on filename and move the file into it's folder using .BAT
body: <p>I have already solved my question... What I haven't solved is how to do this if the <code>.bat</code> file is located in a parent folder and that it should work on all subfolders?</p>
  <p>Right now, there's a limitation that it only create folders if the <code>.bat</code> file is located in the same folder as the files. It can't create folders if the files are inside a subfolder.</p>
  <p>What I have is:</p>
  <p>the filename of this <code>.bat</code> is :</p>
  <p><strong>organize.bat</strong></p>
  <pre><code>@echo off
  for %%i in (*) do (
   if not &quot;%%~ni&quot; == &quot;organize&quot; (
    md &quot;%%~ni&quot; &amp;&amp; move &quot;%%~i&quot; &quot;%%~ni&quot;
   )
  )
  </code></pre>
  <p>How I do it right now:</p>
  <ol>
  <li>I place the <code>.bat</code> file in a folder together with the files</li>
  <li>When I click it, it will create folders with a name based on the files inside that folder</li>
  <li>It will also move each files in those folders of the same name</li>
  </ol>
  <p>What I need:</p>
  <ol>
  <li>Place the <code>.bat</code> file in the main folder with many subfolders containing the files</li>
  <li>Click it to perform the same tasks above</li>
  </ol>
  <p>Apologies if my explanation is confusing... I hope it's still understandable.</p>
  <p>Thank you in advance!</p>