title: Sorting files by date
body: <p>I found this directory checking code on the web and modified it a little, so it would print out added files. There's a buoy that sends me readings every now-and-then, but sometimes the connection is lost and instead of one file it sends multiple files. I need the program to sort them for me by date created. Is there a way to do this?</p>
  
  <pre><code>import os, time
  path_to_watch = 'c://Users//seplema//Documents//arvuti'
  before = dict([(f, None) for f in os.listdir (path_to_watch)])
  while 1:
      after = dict([(f, None) for f in os.listdir (path_to_watch)])
      added = [f for f in after if not f in before]
      if before == after:
          1==1
      else:
          if len(added)==1:
              print added[0]
          else:
              for i in range (0,len(added)):
                  print added[i]
      time.sleep(10)
      before = after
  </code></pre>