title: Exclude files or certain type when writing to Amazon AWS S3
body: <p>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.</p>
  
  <pre><code>Write-S3Object -BucketName bucket-name -Folder folderName -Recurse -Force -KeyPrefix folderName -CannedACLName NoACL
  </code></pre>
  
  <p>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</p>
  
  <pre><code>Write-S3Object -BucketName bucket-name -Folder folderName -Recurse -Force -KeyPrefix folderName -CannedACLName NoACL -SearchPattern "*.svg" -ContentType "image/svg+xml"
  </code></pre>
  
  <p>So I have two questions here.</p>
  
  <p>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?</p>
  
  <p>2) Is there a away to specify files to exclude in <code>-SearchPattern</code> parameter of <code>Write-S3Object</code>?</p>
  
  <p>Thanks.</p>