Skip to content

Conversation

@jterapin
Copy link
Contributor

@jterapin jterapin commented Oct 13, 2025

Adds directory upload/download to Transfer Manager.

upload_directory

  • Upload all files from a local directory to S3
  • Optional recursive traversal of subdirectories
  • Symlink handling with circular reference detection
  • S3 key prefix support
  • Filter callback to selectively upload files
  • Request callback to modify upload parameters per file
  • Progress callback for transfer monitoring
  • Configurable failure handling (fail-fast or continue on error)

download_directory

  • Download all objects from an S3 bucket/prefix to a local directory
  • S3 prefix stripping for clean local paths
  • Path traversal detection
  • Filter callback to selectively download objects
  • Request callback to modify download parameters per object
  • Progress callback for transfer monitoring
  • Configurable failure handling (fail-fast or continue on error)
  • Automatic directory creation for nested structures

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

  1. To make sure we include your contribution in the release notes, please make sure to add description entry for your changes in the "unreleased changes" section of the CHANGELOG.md file (at corresponding gem). For the description entry, please make sure it lives in one line and starts with Feature or Issue in the correct format.

  2. For generated code changes, please checkout below instructions first:
    https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md

Thank you for your contribution!

@github-actions
Copy link

github-actions bot commented Oct 13, 2025

Detected 1 possible performance regressions:

  • aws-sdk-kinesis.gem_size_kb - z-score regression: 81.5 -> 82.0. Z-score: Infinity

@jterapin jterapin marked this pull request as ready for review January 14, 2026 17:30
# * `:completed_downloads` - Number of objects successfully downloaded
# * `:failed_downloads` - Number of objects that failed to download
# * `:errors` - Array of errors for failed downloads (only present when failures occur)
def download_directory(destination, bucket:, **options)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to allow for setting a custom thread for executor here. Same goes for uploader.

request_abort unless opts[:ignore_failure]
end

def process_download_queue(producer, downloader, opts)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a situation where we need to raise, I decided against doing @queue_executor.kill since there might be work in-flight that hangs. It would be best to exit gracefully and the bubbles up to raise within #build_results

raise ArgumentError, 'Invalid directory' unless Dir.exist?(source_directory)

uploader = FileUploader.new(
multipart_threshold: opts.delete(:multipart_threshold),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-reminder to documentation this at TransferManager#upload_directory

I need to take a look at other params available on FileUploader and FileDownloader level but I'm concerned about overlapped params if it occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant