Last active
December 18, 2015 12:39
-
-
Save robyurkowski/5784487 to your computer and use it in GitHub Desktop.
Uploading a selection of S3 files' metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options = { | |
'x-amz-metadata-directive' => 'REPLACE', | |
'Content-Type' => 'application/pdf', | |
'Content-Disposition' => nil | |
} | |
count = 0 | |
files = directory.files.each do |file| | |
next unless file.key =~ /pdf\z/i | |
count += 1 | |
file.copy(directory.key, file.key, options) | |
puts "Updated #{file.key}" | |
end | |
puts "Updated #{count} files." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How did you get the directory object? Currently, I am making use of Ruby AWS SDK version 2.
I get the list of objects in my S3 bucket, using Resource -> Bucket -> Objects.