Skip to content

Instantly share code, notes, and snippets.

@fgblanch
Created July 19, 2013 12:10
Show Gist options
  • Select an option

  • Save fgblanch/6038699 to your computer and use it in GitHub Desktop.

Select an option

Save fgblanch/6038699 to your computer and use it in GitHub Desktop.

Revisions

  1. fgblanch renamed this gist Jul 19, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. fgblanch created this gist Jul 19, 2013.
    27 changes: 27 additions & 0 deletions gistfile1.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    AmazonS3 s3 = new AmazonS3Client(new PropertiesCredentials(MyClass.class.getResourceAsStream("AwsCredentials.properties")));

    String s3Key = "folder1/folder2";


    String bucketName = Constantes.S3_BUCKET;
    String key = s3Key +"/input_chopped/";

    ObjectListing current = s3.listObjects(new ListObjectsRequest()
    .withBucketName(bucketName)
    .withPrefix(key));

    boolean siguiente = true;

    while (siguiente) {

    siguiente &= current.isTruncated();
    contador += current.getObjectSummaries().size();

    for (S3ObjectSummary objectSummary : current.getObjectSummaries()) {
    S3Object object = s3.getObject(new GetObjectRequest(bucketName, objectSummary.getKey()));
    System.out.println(object.getKey());
    }

    current=s3.listNextBatchOfObjects(current);

    }