#!/usr/bin/env ruby bucket = ARGV[0] file = ARGV[1..-1].join(' ') # Special case for index.html files - let them work as /directoryname and /directoryname/ puts("Handling: #{file}") if file =~ /^\.\/(.+)\/index.html$/ filebase = $1 `s3cmd.rb put \"#{bucket}:#{filebase}\" \"#{file}\" x-amz-acl:public-read content-type:text/html` `s3cmd.rb put \"#{bucket}:#{filebase}/\" \"#{file}\" x-amz-acl:public-read content-type:text/html` end filepath = file[2..-1] `s3cmd.rb put \"#{bucket}:#{filepath}\" \"#{file}\" x-amz-acl:public-read content-type:text/html`