title: how to move files in different sub-directories?
body: <p>i have a directory with files with different extensions, i have to move these files in their folder (creating them) inside the &quot;files directory&quot;, i write that but i need help (first project please be gentle)</p>
  <pre class="lang-py prettyprint-override"><code>import os
  import shutil
  
  os.makedirs(&quot;C:\\FileOrganizer\\FileOrganizer\\Files\\Images&quot;)
  os.makedirs(&quot;C:\\FileOrganizer\\FileOrganizer\\Files\\Text&quot;)
  os.makedirs(&quot;C:\\FileOrganizer\\FileOrganizer\\Files\\Mp3&quot;)
  
  src_fldr = &quot;C:\\FileOrganizer\\FileOrganizer\\Files&quot;
  fldr_img =&quot;C:\\FileOrganizer\\FileOrganizer\\Files\\Images&quot;
  fldr_txt = &quot;C:\\FileOrganizer\\FileOrganizer\\Files\\Text&quot;
  fldr_mp3 = &quot;C:\\FileOrganizer\\FileOrganizer\\Files\\Mp3&quot;
  
  for file in os.listdir(src_fldr): 
      filename = os.fsdecode(file)
      if filename.endswith(&quot;.txt&quot;, &quot;.otd&quot;):
          shutil.move(src_fldr, fldr_txt)
      elif filename.endswith(&quot;.jpeg&quot;, &quot;.jpg&quot;, &quot;.png&quot;):
          shutil.move(src_fldr, fldr_img)
      elif filename.endswith(&quot;.mp3&quot;):
          shutil.move(src_fldr, fldr_mp3)
      else: 
          pass
  </code></pre>