I have backups stored on Amazon S3. The folder structure is
my-bucket - db_backup - ...... - 2017.02.20.03.30.03 - db_backup.tar - 2017.02.21.03.30.04 - db_backup.tar I would like to make a rake task that would take the most recent backup from S3 and deploy it to me locally. for this, I decided to use the gem 'aws-sdk', '2.7.11'
The code below downloads the backup to the specified path and it works successfully.
Aws::S3::Client.new.get_object(bucket: 'my-bucket', key: 'db_backup/2017.02.21.03.30.03/db_backup.tar', response_target: 'tmp/db_backup.tar') but I would like the most recent folder to be automatically selected instead of 2017.02.21.03.30.03/ please tell 2017.02.21.03.30.03/ how to get the latest folder in the db_backup/ folder