-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f75cc97
commit 81daf81
Showing
1 changed file
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
# This is an example of what we want our script to look like for transferring image files from a source location to a destination. | ||
# This is an example of what we want our script to look like for | ||
# transferring image files from a source location to a destination. | ||
# ruby data/copy_images.rb /Users/faisonr/Downloads/imagecat-images-practice-1/input/disk14 s3://puliiif-staging | ||
source = ARGV[0] | ||
destination = ARGV[1] | ||
puts "Copying files from #{source} to #{destination}" | ||
files = Dir["#{source}/**/*.tiff"] | ||
files.each do |file_name| | ||
puts file_name | ||
file_parts = file_name.split("/") | ||
file_parts[-1] = file_parts[-1].chop | ||
s3_safe_file_name = "imagecat-#{file_parts[-4..-1].join("-")}" | ||
file_parts = file_name.split('/') | ||
file_parts[-1] = file_parts[-1].chop | ||
s3_safe_file_name = "imagecat-#{file_parts[-4..].join('-')}" | ||
`aws s3 cp #{file_name} #{destination}/#{s3_safe_file_name}` | ||
end | ||
|
||
# "/Users/faisonr/Downloads/imagecat-images-practice-1/input/disk14/**/*.tiff" | ||
# "/Users/faisonr/Downloads/imagecat-images-practice-1/input/disk14/**/*.tiff" |