Skip to content

Commit

Permalink
Allow copy_images to take a list of images to sync. (#192)
Browse files Browse the repository at this point in the history
* Allow copy_images to take a list of images to sync.

* Rubocop
  • Loading branch information
tpendragon committed Oct 12, 2023
1 parent 720f8fd commit 4455c1c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions data/copy_images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@
source = ARGV[0]
destination = ARGV[1]
puts "Copying files from #{source} to #{destination}"
files = Dir[File.join(source, '**/*.tiff')]
sync_dir = File.join(source, 'for_aws_sync')
# If a directory is passed then we're synchronizing.
files = if File.directory?(source)
Dir[File.join(source, '**/*.tiff')]
else
# If it's a file, then assume it holds a newline-delimited list of files to
# synchronize.
File.read(source).split("\n")
end
root_dir = File.directory?(source) ? source : File.dirname(source)
sync_dir = File.join(root_dir, 'for_aws_sync')
Dir.mkdir(sync_dir)
files.each do |file_name|
puts file_name
Expand Down

0 comments on commit 4455c1c

Please sign in to comment.