title: Downloading Only Newest File Using Wget / Curl
body: <p>How would I use wget or curl to download the newest file in a directory?</p>
  
  <p>This seems really easy, however the filename won't always be predictable, and as new data comes in it'll be replaced with a random filename. </p>
  
  <p>Specifically, the directory I wish to download data from has the following naming structure, where the last string of characters is a randomly generated timestamp:</p>
  
  <pre><code>MRMS_RotationTrackML1440min_00.50_20160530-175837.grib2.gz
  MRMS_RotationTrackML1440min_00.50_20160530-182639.grib2.gz
  MRMS_RotationTrackML1440min_00.50_20160530-185637.grib2.gz
  </code></pre>
  
  <p>The randomly generated timestamp is in the format of: {hour}{minute}{second}</p>
  
  <p>The directory in question is here: <a href="http://mrms.ncep.noaa.gov/data/2D/RotationTrackML1440min/" rel="nofollow">http://mrms.ncep.noaa.gov/data/2D/RotationTrackML1440min/</a></p>
  
  <p>Could it have to be something with something in the headers, where you'd use curl to sift through the last-modified timestamp?</p>
  
  <p>Any help would be appreciated here, thanks in advance. </p>