title: Find duplicate filenames, and only keep newest file using python
body: <p>I have +20 000 files, that look like this below, all in the same directory:</p>
  
  <pre><code>8003825.pdf
  8003825.tif
  8006826.tif
  </code></pre>
  
  <p>How does one find all duplicate filenames, while ignoring the file extension.</p>
  
  <p>Clarification: I refer to a duplicate being a file with the same filename while ignoring the file extension. I do <strong>not</strong> care if the file is not 100% the same (ex. hashsize or anything like that)</p>
  
  <p>For example: </p>
  
  <pre><code>"8003825" appears twice
  </code></pre>
  
  <p>Then look at the metadata of each duplicate file and only keep the newest one.</p>
  
  <p>Similar to this post:</p>
  
  <p><a href="https://stackoverflow.com/questions/11732465/keep-latest-file-and-delete-all-other">Keep latest file and delete all other</a></p>
  
  <p>I think I have to create a list of all files, check if file already exists. If so then use os.stat to determine the modification date? </p>
  
  <p>I'm a little concerned about loading all those filename's into memory. And wondering if there is a more pythonic way of doing things...</p>
  
  <p>Python 2.6
  Windows 7</p>