The Above solutions are Bash for if one want to do the same thing in Powershell for downloading in windows using the follwing script :
# This assumes AWS CLI exe is in your path.
$s3location = "s3://bucket-name"
$files = $(aws s3 ls $s3location --recursive | sort | select -last 3)
$dlPath = "C:\TEMP"
foreach ($s3FileInfo in $files) {
$filename = $s3FileInfo.Split()[-1]
$path = "${s3location}/${filename}"
aws s3 cp $path $dlPath
echo("Done downloading ${path} to ${dlPath}")
}