title: Download a Large Number of Files Using the Java SDK for Amazon S3 Bucket
body: <p>I have a large number of files that need to be downloaded from an S3 bucket. My problem is similar to <a href="https://stackoverflow.com/questions/1051275/downloading-a-large-number-of-files-from-s3">this article</a> except I am trying to run it in Java. </p>
  
  <pre><code>public static void main(String args[]) {
          AWSCredentials myCredentials = new BasicAWSCredentials("key","secret");
          TransferManager tx = new TransferManager(myCredentials);
          File file = &lt;thefile&gt;
          try{
          MultipleFileDownload myDownload = tx.downloadDirectory("&lt;bucket&gt;", null, file);
          System.out.println("Transfer: " + myDownload.getDescription());
          System.out.println("  - State: " + myDownload.getState());
          System.out.println("  - Progress: " + myDownload.getProgress().getBytesTransfered());
  
          while (myDownload.isDone() == false) {
             System.out.println("Transfer: " + myDownload.getDescription());
             System.out.println("  - State: " + myDownload.getState());
              System.out.println("  - Progress: " + myDownload.getProgress().getBytesTransfered());
              try {
                  // Do work while we wait for our upload to complete...
                  Thread.sleep(500);
              } catch (InterruptedException ex) {
                  ex.printStackTrace();
              }
           }
           } catch(Exception e){
            e.printStackTrace();
           }
  
        }
  </code></pre>
  
  <p>This was adapted from the TransferManager class example for multiple upload. There are well over a 100,000 objects in this bucket. Any help would be great.</p>