AWS S3 download and copy
<p>We have a bucket in AWS S3 where backups from production are being copy to. </p>

<p>My task is to copy the most recent backup file from AWS S3 to the local sandbox SQL Server, then do the restore.</p>

<p>I have installed all of the AWS tools for windows on the local server. Credentials to connect to AWS S3 work, etc.
My local server can list all of the files in the AWS S3 bucket. I can successfully download a single file if I specifically name that file.</p>

<p>Here is an example of that working pulling the most recent copy from July 25, 2016.</p>

<pre><code>aws s3 cp s3://mybucket/databasefile_20160725.zip E:\DBA 
</code></pre>

<p>My goal is to have a copy script that only pulls the most recent file, which I won't know the name of. I want to schedule this.</p>

<p>Nothing I google or try is getting me the correct syntax to do this.</p>