Use the below script to download the files from any S3 bucket to your local machine
$sourceBucket = '<bucket name from where you want to copy the files from>'
$profile = '<aws profile name>'
$Folder = '<Folder Path on local drive>'
$items = Get-S3Object -BucketName $sourceBucket -ProfileName $profile -Region 'us-east-1'
Write-Host "$($items.Length) objects to copy"
$index = 1
$items | % {
Write-Host "$index/$($items.Length): $($_.Key)"
$fileName = $Folder + ".\$($_.Key.Replace('/','\'))"
Write-Host "$fileName"
Read-S3Object -BucketName $sourceBucket -Key $_.Key -File $fileName -ProfileName $profile -Region 'us-east-1' > $null
$index += 1
}
Disclosure: We use affiliate links to monetize our content. We may receive a commission on products or services that you purchase through clicking on links within this blog.