public static interface UploadDirectoryRequest.Builder extends CopyableBuilder<UploadDirectoryRequest.Builder,UploadDirectoryRequest>
| Modifier and Type | Method and Description |
|---|---|
UploadDirectoryRequest.Builder |
bucket(String bucket)
The name of the bucket to upload objects to.
|
UploadDirectoryRequest |
build()
An immutable object that is created from the
properties that have been set on the builder.
|
UploadDirectoryRequest.Builder |
followSymbolicLinks(Boolean followSymbolicLinks)
Specifies whether to follow symbolic links when traversing the file tree in
S3TransferManager.downloadDirectory(com.ibm.cos.v2.transfer.s3.model.DownloadDirectoryRequest) operation |
UploadDirectoryRequest.Builder |
maxDepth(Integer maxDepth)
Specifies the maximum number of levels of directories to visit.
|
UploadDirectoryRequest.Builder |
s3Delimiter(String s3Delimiter)
Specifies the delimiter.
|
UploadDirectoryRequest.Builder |
s3Prefix(String s3Prefix)
Specifies the key prefix to use for the objects.
|
UploadDirectoryRequest.Builder |
source(Path source)
Specifies the source directory to upload.
|
UploadDirectoryRequest.Builder |
uploadFileRequestTransformer(Consumer<UploadFileRequest.Builder> uploadFileRequestTransformer)
Specifies a function used to transform the
UploadFileRequests generated by this UploadDirectoryRequest. |
copyapplyMutationUploadDirectoryRequest.Builder source(Path source)
Note that the current user must have read access to all directories and files,
otherwise SecurityException will be thrown.
source - the source directoryUploadDirectoryRequest.Builder bucket(String bucket)
bucket - the bucket nameUploadDirectoryRequest.Builder s3Prefix(String s3Prefix)
See Organizing objects using prefixes
Note: if the provided prefix ends with the same string as delimiter, it will get "normalized" when generating the key name. For example, assuming the prefix provided is "foo/" and the delimiter is "/" and the source directory has the following structure:
|- test
|- obj1.txt
|- obj2.txt
the object keys will be "foo/obj1.txt" and "foo/obj2.txt" as apposed to "foo//obj1.txt" and "foo//obj2.txt"s3Prefix - the key prefixs3Delimiter(String)UploadDirectoryRequest.Builder s3Delimiter(String s3Delimiter)
"/" will be used.
See Organizing objects using
prefixes
Note: if the provided prefix ends with the same string as delimiter, it will get "normalized" when generating the key name. For example, assuming the prefix provided is "foo/" and the delimiter is "/" and the source directory has the following structure:
|- test
|- obj1.txt
|- obj2.txt
the object keys will be "foo/obj1.txt" and "foo/obj2.txt" as apposed to "foo//obj1.txt" and "foo//obj2.txt"s3Delimiter - the delimiters3Prefix(String)UploadDirectoryRequest.Builder followSymbolicLinks(Boolean followSymbolicLinks)
S3TransferManager.downloadDirectory(com.ibm.cos.v2.transfer.s3.model.DownloadDirectoryRequest) operation
Default to false
followSymbolicLinks - whether to follow symbolic linksUploadDirectoryRequest.Builder maxDepth(Integer maxDepth)
Default to Integer.MAX_VALUE
maxDepth - the maximum number of directory levels to visitUploadDirectoryRequest.Builder uploadFileRequestTransformer(Consumer<UploadFileRequest.Builder> uploadFileRequestTransformer)
UploadFileRequests generated by this UploadDirectoryRequest.
The provided function is called once for each file that is uploaded, allowing you to modify the paths resolved by
TransferManager on a per-file basis, modify the created PutObjectRequest before it is passed to S3, or
configure a TransferRequestOverrideConfiguration.
The factory receives the UploadFileRequests created by Transfer Manager for each file in the directory
being uploaded, and returns a (potentially modified) UploadFileRequest.
Usage Example:
// Add a LoggingTransferListener to every transfer within the upload directory request
UploadDirectoryOverrideConfiguration directoryUploadConfiguration =
UploadDirectoryOverrideConfiguration.builder()
.uploadFileRequestTransformer(request -> request.addTransferListener(LoggingTransferListener.create())
.build();
UploadDirectoryRequest request =
UploadDirectoryRequest.builder()
.source(Paths.get("."))
.bucket("bucket")
.prefix("prefix")
.overrideConfiguration(directoryUploadConfiguration)
.build()
UploadDirectoryTransfer uploadDirectory = transferManager.uploadDirectory(request);
// Wait for the transfer to complete
CompletedUploadDirectory completedUploadDirectory = uploadDirectory.completionFuture().join();
// Print out the failed uploads
completedUploadDirectory.failedUploads().forEach(System.out::println);
uploadFileRequestTransformer - A transformer to use for modifying the file-level upload requests before executionUploadDirectoryRequest build()
SdkBuilderbuild in interface Buildablebuild in interface SdkBuilder<UploadDirectoryRequest.Builder,UploadDirectoryRequest>Copyright © 2026. All rights reserved.