title: Find/Remove oldest file in directory
body: <p>I am trying to delete oldest file in directory when number of files reaches a threshold.</p>
  
  <pre><code>list_of_files = os.listdir('log')    
  
  if len([name for name in list_of_files]) == 25:
      oldest_file = min(list_of_files, key=os.path.getctime)
      os.remove('log/'+oldest_file)
  </code></pre>
  
  <p>Problem: The issue is in min method. list_of_files does not contain full path, so it is trying to search file in current directory and failing. How can I pass directory name ('log') to min()?</p>