我正在使用 Ruby 和 aws-sdk 从 S3 下载一个文件夹。如何检查每个文件是否下载成功?它只是检查本地机器上是否存在文件吗?
File.open("#{meeting_dir}/#{o.key}","wb") do |f|
f.write(o.read)
end
you can check the file size of the amazon key with S3Object#content_length
method and compare it with the size of the downloaded file File.size 'downloaded_file'
.
http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/S3Object.html#content_length-instance_method