mardi 23 juin 2015

Amazon AWS S3 bucket recursive fetch

I'm using amazon s3 java library to connect to my s3 bucket and get the list of files. I need to browse through this directories recursively. While doing so, if I encounter a file, I need to download it. How to differentiate between directories and files in S3.

Here is my code snippet

AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
AmazonS3 s3Client = new AmazonS3Client(credentials);
ObjectListing objectsListing = s3Client.listObjects(new ListObjectsRequest(bucketName, prefix, null, null, Integer.MAX_VALUE));

Once I get the object listing of the upper level directory, I need to get the list of directories and files and process them

If there is a way to do it, please help me out with this

Thanks




Aucun commentaire:

Enregistrer un commentaire