I am trying to upload folders to S3 to serve as static website. The problem I have is that within the folders, there are files of certain extensions such as .css, .png, .svg, etc. I am using AWS PowerShell tools and when I upload the following command, the .svg files are uploaded with wrong content-type.
Write-S3Object -BucketName bucket-name -Folder folderName -Recurse -Force -KeyPrefix folderName -CannedACLName NoACL
As a workaround, I came up with is to iterate the folders and do not upload the .svg files. The re-iterate the folders and only upload .svg setting up correct -content-type
Write-S3Object -BucketName bucket-name -Folder folderName -Recurse -Force -KeyPrefix folderName -CannedACLName NoACL -SearchPattern "*.svg" -ContentType "image/svg+xml"
So I have two questions here.
1) Instead of doing the two step approach, can I upload all the files in one go setting up correct content-type for svg files?
2) Is there a away to specify files to exclude in -SearchPattern
parameter of Write-S3Object
?
Thanks.