code: private String getMostRecentMatchingKey(AmazonS3 s3Client, String bucketName, String regex) {
      ObjectListing objectListing = s3Client.listObjects(bucketName);
      TreeMap<Date, String> keys = new TreeMap<>();
      for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
        if (objectSummary.getKey().matches(regex)) {
          keys.put(objectSummary.getLastModified(), objectSummary.getKey());
        }
      }
      if (keys.size() == 0)
        throw new MolgenisDataException("No key matching regular expression: " + regex);
      return keys.lastEntry().getValue();
    }
docs: downloaded.