title: python - find filenames different than foldername
body: <p>My company have files named </p>
  
  <pre><code>"3688-35(DUSTY GREY-BLK).jpg"
  "3688-36A(SLIVER).jpg"
  "..."
  </code></pre>
  
  <p>which should be placed at "<strong>3688</strong>" folder.</p>
  
  <p>after years and years I'm facing <em>6 digits pictures and ~3500 folders</em> with countless misplaced pictures need to be checked is placed in right folder,</p>
  
  <p>So I think I can write a script can list only wrong placed files and folder like</p>
  
  <pre><code>"1111/1112.jpg"
  "1234/1243.jpg"
  </code></pre>
  
  <p>after I do some search I find <a href="https://stackoverflow.com/questions/12930303/match-filenames-to-foldernames-then-move-files">match filenames to foldernames then move files</a> is kind of what I need but I cannot modify the answer to my need because the filename pattern.</p>
  
  <p>I stuck at first but I think <a href="https://pymotw.com/2/glob/" rel="nofollow noreferrer">https://pymotw.com/2/glob/</a> can do some trick on listing and with <a href="https://linux.die.net/man/3/fnmatch" rel="nofollow noreferrer">https://linux.die.net/man/3/fnmatch</a>?</p>