title: S3 Boto Downloading - Most Recent
body: <p>I am new to Python coding and havent been able to progress on this. I have some time encoded filenames in the following format:</p>
  
  <pre><code>20121208151318.gzip
  20121208151320.gzip
  20121208151322.gzip
  20121208151325.gzip
  20121208151326.gzip
  </code></pre>
  
  <p>Using this code I can print the filenames of all the files in my S3 bucket:</p>
  
  <pre><code>import boto
  s3conn = boto.connect_s3()
  bucket = s3conn.lookup('my_bucket_name')
  for key in bucket:
    print k.name
  
  key.getfile()
  </code></pre>
  
  <p>I need help with two aspects. Firstly how can I get the name of the most recent file in the bucket, which would in my case be:</p>
  
  <pre><code>20121208151326 (15:13:26 - 8th December 2012)
  </code></pre>
  
  <p>Secondly, how can I then download this file? I found the key.getfile() command but I cant work how to implement it.</p>