title: Getting the latest file modified from Azure Blob
body: <p>Say I am generating a couple of <code>json</code> files each day in my blob storage. What I want to do is to get the latest file modified in any of my directories. So I'd have something like this in my blob:</p>
  
  <pre><code>2016/01/02/test.json
  2016/01/02/test2.json
  2016/02/03/test.json
  </code></pre>
  
  <p>I want to get <code>2016/02/03/test.json</code>. So one way is getting the full path of the file and do a regex checking to find the latest directory created, but this doesn't work if I have more than one <code>josn</code> file in each dir. Is there anything like <code>File.GetLastWriteTime</code> to get the latest modified file?
  I am using these codes to get all the files btw:</p>
  
  <pre><code>public static CloudBlobContainer GetBlobContainer(string accountName, string accountKey, string containerName)
  {
      CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
      // blob client
      CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
      // container
      CloudBlobContainer blobContainer = blobClient.GetContainerReference(containerName);
      return blobContainer;
  }
  
  public static IEnumerable&lt;IListBlobItem&gt; GetBlobItems(CloudBlobContainer container)
  {
      IEnumerable&lt;IListBlobItem&gt; items = container.ListBlobs(useFlatBlobListing: true);
      return items;
  }
  
  public static List&lt;string&gt; GetAllBlobFiles(IEnumerable&lt;IListBlobItem&gt; blobs)
  {
      var listOfFileNames = new List&lt;string&gt;();
  
      foreach (var blob in blobs)
      {
          var blobFileName = blob.Uri.Segments.Last();
          listOfFileNames.Add(blobFileName);
      }
      return listOfFileNames;
  }
  </code></pre>