I've got it to work for what I need, it is probably really bad code but it works... Here it is, I would use this at your own risk. It uses touch to update the time on the file based on the meta data, if the meta data isn't there then it uses the Last Modified data from Amazon.
In s3sync.rb
Below:
def symlink?()
unless @result
@result = S3sync.S3try(:head, @bucket, @path)
end
debug("symlink value is: #{@result.object.metadata['symlink']}")
@result.object.metadata['symlink'] == 'true'
end
Add:
def date2
unless @result
@result = S3sync.S3try(:head, @bucket, @path)
end
debug("date could be: #{@result.object.metadata['date']}")
@result.object.metadata['date'].to_s
end
Below:
s3o = S3::S3Object.new(theStream, meta)
debug(@path)
headers = {'Content-Length' => (fromNode.size.respond_to?(:nonzero?) ? fromNode.size.to_s : '0')}
Add:
headers['x-amz-meta-date'] = fromNode.date.to_s
I wasn't sure the proper place to put this, but I grouped it with the chmod/chown because it was modifying the file so I figured it was a good place to stick it.
Below:
# clean up if the temp file is still there (as for links)
File.unlink(fName) if File.exist?(fName)
# update permissions
linkCommand = fromNode.symlink? ? 'l' : ''
begin
Add:
if fromNode.date2.to_s == ""
thedate = fromNode.date.to_s
else
thedate = fromNode.date2.to_s
end
file = @path
`touch -d "#{thedate}" #{file}`