title: How to upload all files of a specific type to S3 Bucket?
body: <p>When I do this:</p>
  
  <pre><code>foreach ($f in (Get-ChildItem -filter "*.flv")){
      Write-S3Object -BucketName bucket.example -File $f.fullName -Key $f.name -CannedACLName PublicRead
  }
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Write-S3Object :
  At line:1 char:51
  +  foreach ($f in (Get-ChildItem -filter "*.flv")){ Write-S3Object -BucketName xx. ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (Amazon.PowerShe...eS3ObjectCmdlet:WriteS3ObjectCmdlet) [Write-S3Objec
     t], InvalidOperationException
      + FullyQualifiedErrorId : Amazon.S3.AmazonS3Exception,Amazon.PowerShell.Cmdlets.S3.WriteS3ObjectCmdlet
  </code></pre>
  
  <p>What am I doing wrong? Is there anything I can do to see more of the error, or is this just a syntax issue?</p>
  
  <p>How can I otherwise upload all of a certain filetype to a bucket using powershell?</p>
  
  <h2>EDIT:</h2>
  
  <p>I  intentionally set <code>Set-DefaultAWSRegion</code> to a region that the bucket wasn't in, and got </p>
  
  <pre><code>Write-S3Object : The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. 
  </code></pre>
  
  <p>as an error message, as expected, so it looks like it can connect to the bucket and it knows that it isn't in a certain region.</p>
  
  <p>Also, if I enter the  <code>s3://</code> prefix before the bucket name, I get a message that the bucket couldn't be found, so it it looks like what I'm entering now is correct.</p>
  
  <p>I can do Get-S3Bucket and see all of the buckets on my account, so I know that it's configured correctly.</p>
  
  <h2>EDIT2:</h2>
  
  <p>If I do:</p>
  
  <pre><code>&gt; $f = Get-ChildItem -filter "*.flv"
  &gt; Write-S3Object
  
  cmdlet Write-S3Object at command pipeline position 1
  Supply values for the following parameters:
  BucketName: bucket.name
  Key: $f[0].name
  File: $f[0].fullName
  Write-S3Object : The file indicated by the FilePath property does not exist!
  At line:1 char:1
  + Write-S3Object
  + ~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (Amazon.PowerShe...eS3ObjectCmdlet:WriteS3ObjectCmdlet) [Write-S3Objec
     t], InvalidOperationException
      + FullyQualifiedErrorId : System.ArgumentException,Amazon.PowerShell.Cmdlets.S3.WriteS3ObjectCmdlet
  </code></pre>
  
  <p>If I do <code>$f[0].fullName</code> seperately, I get the full path to the object.
  However, this has spaces in it. Could this be a problem?</p>