title: Python: how to move a file with a certain name to a folder with the same name
body: <p>I have a situation in which the directory I'm working at has many files and folders (something like that):</p>
  <pre><code>AAA_SUBFOLDER
  AAA_FILE_1
  AAA_FILE_2
  BBB_SUBFOLDER
  BBB_FILE_1
  BBB_FILE_2
  </code></pre>
  <p>So files and subfolders both starting with <code>AAA</code> or <code>BBB</code>(and so on with CCC, DDD..). What I'd like to do is a <strong>python script</strong> that moves all the <code>AAA</code> files to the <code>AAA</code> subfolder and iterate this for all the files and subfolders with the same names in order to obtain something like this:</p>
  <pre><code>AAA_SUBFOLDER
    - AAA_FILE_1
    - AAA_FILE_2
  BBB_SUBFOLDER
    - BBB_FILE_1
    - BBB_FILE_2
  ...
  </code></pre>
  <p>Can you help me? Thanks in advance!</p>