title: Finding files in Python with date filter
body: <p>How can I find files with filtering according to being newer than some query date in Python without crawling the entire search directory?  E.g., in Bash/*nix (tested on MacOS) I can do <code>find . -newermt '2018-01-17 03:28:46'</code>, which <em>quickly</em> searches for the files just newer than the specified query date.  In Python I can do:</p>
  
  <pre><code>import os
  import datetime
  
  query_date = datetime.datetime.fromtimestamp(int(float(1516188526532974000)/1000000000))
  results = []
  for root, dirs, files in os.walk('/Users/Nafty/Sync/sxs'):
      for filename in files:
          path = os.path.join(root, filename)
          file_mtime = datetime.datetime.fromtimestamp(os.stat(path).st_mtime)
          if(file_mtime &gt; query_date):
              results.append(path)  # yield path?
  
  return results
  </code></pre>
  
  <p>However, this takes longer and seems to walk through the entire directory regardless.</p>
  
  <p>Is there a way to do a fast search version of date-filtered directory crawling in Python, similar to the Bash example?</p>