how to get files in s3 directory?

You need to use the AWS::S3 gem: http://amazon.rubyforge.org/

Then, connect to S3:

AWS::S3::Base.establish_connection!(         :access_key_id => 'access_key_id',         :secret_access_key => 'secret_access_key'       )

And send your file:

AWS::S3::S3Object.store('file_name', file_contents, 'bucket_name')

You can use HTTP calls directly with the Amazon S3 REST API (http:// docs.amazonwebservices.com/AmazonS3/latest/) if you want, but that's what the AWS::S3 gem is doing for you anyway - it just saves you a lot of time.

You can use also the Amazon S3 SOAP API. Ruby and Rails will be able to interact with either API in a fairly straightforward manner, if you understand SOAP or REST, but neither have S3 support built in.