how to get files in s3 directory?

You need to use the AWS::S3 gem:

Then, connect to S3:

        :access_key_id => 'access_key_id',
        :secret_access_key => 'secret_access_key'

And send your file:'file_name', file_contents, 'bucket_name')

You can use HTTP calls directly with the Amazon S3 REST API (http:// 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.