S3TransferManager AWS JAVA SDk V 2.X downloadDirectory() method downloading objects with wrong file name

952 views Asked by At

I am using JAVA 1.8 and S3TransferManager(Java SDK V2.X) to download all objects from S3 bucket and i am using

<dependency>
  <groupId>software.amazon.awssdk</groupId>
  <artifactId>s3-transfer-manager</artifactId>
  <version>2.17.247-PREVIEW</version>
</dependency>

Code appears as below ...

           S3TransferManager s3TransferManager = S3TransferManager.create();

           DirectoryDownload directoryDownload = s3TransferManager
                        .downloadDirectory(DownloadDirectoryRequest.builder()
                        .destinationDirectory(Paths.get("/home/shashank/Documents"))
                        .bucket(bucketName)
                        .prefix(bucketPath)
                        .build());

        // Wait for the transfer to complete
        CompletedDirectoryDownload completedDirectoryDownload = directoryDownload.completionFuture().join();

        // Print out the failed downloads
        completedDirectoryDownload.failedTransfers().forEach(System.out::println);

...

This code is downloading all files from S3 but omitting first charater from file name.

Ex : Download files are renamed to mage.jpg and itle.png Actual objects in S3 were image.jpg and title.png

Please guide me if i am doing something wrong.

0

There are 0 answers