title: Python: Get a list of all files and folders in a directory, the time of creation, the time of last modification. System independent solution?
body: <p>This is a challenge as well as a question:</p>
  
  <p>I have a folder of data files.
  I want the following list of lists of information:</p>
  
  <pre><code>Filename:      Created:                     Last modified:
  
  Information = 
  [
  [datafile1,    Mon Mar 04 10:45:24 2013,    Tue Mar 05 12:05:09 2013],
  [datafile2,    Mon Mar 04 11:23:02 2013,    Tue Apr 09 10:57:55 2013],
  [datafile2.1,  Mon Mar 04 11:37:21 2013,    Tue Apr 02 15:35:58 2013],
  [datafile3,    Mon Mar 04 15:36:13 2013,    Thu Apr 18 15:03:25 2013],
  [datafile4,    Mon Mar 11 09:20:08 2013,    Mon May 13 16:30:59 2013]
  ]
  </code></pre>
  
  <p>I can sort it myself after I have the Information.
  Can someone write the function:</p>
  
  <pre><code>def get_information(directory):
      .
      .
      .
      return Information
  </code></pre>
  
  <p>These posts are useful:</p>
  
  <p>1)  <a href="https://stackoverflow.com/questions/168409/how-do-you-get-a-directory-listing-sorted-by-creation-date-in-python">How do you get a directory listing sorted by creation date in python?</a></p>
  
  <p>2)  <a href="https://stackoverflow.com/questions/6759415/sorting-files-by-date">Sorting files by date</a></p>
  
  <p>3)  <a href="https://stackoverflow.com/questions/237079/how-to-get-file-creation-modification-date-times-in-python?rq=1">How to get file creation &amp; modification date/times in Python?</a></p>
  
  <p>4)  <a href="https://stackoverflow.com/questions/10943858/python-sort-files-by-datetime-in-more-details?lq=1">Python: sort files by datetime in more details</a></p>
  
  <p>5)  <a href="https://stackoverflow.com/questions/6759415/sorting-files-by-date?lq=1">Sorting files by date</a></p>
  
  <p>6)  <a href="https://stackoverflow.com/questions/121025/how-do-i-get-the-modified-date-time-of-a-file-in-python?lq=1">How do I get the modified date/time of a file in Python?</a></p>
  
  <p>However: I feel there must exist a better, more re-usable solution which works on windows, and linux. </p>