Question:
I have used Java SDK and try to download Folder using GetObjectRequest class, but it is possible to download my folder incuding its subFolder and all files to download ?
Answer:
You can use downloadDirectory
method from TransferManager
class:
1 2 3 4 5 6 |
TransferManager transferManager = new TransferManager(new DefaultAWSCredentialsProviderChain()); File dir = new File("destDir"); MultipleFileDownload download = transferManager.downloadDirectory("myBucket", "myKey", dir); download.waitForCompletion(); |
As it is written in the documentation, this method:
Downloads all objects in the virtual directory designated by the keyPrefix given to the destination directory given. All virtual subdirectories will be downloaded recursively.