我正在编写Powershell脚本以将多个文件夹和子文件夹上载到AWS S3存储桶,它给出以下错误。我重新创建了相同的上传单个文件夹,并且错误仍然相同。但是,当我尝试使用-File参数上传文件时,它工作正常。有人可以帮我吗?
Write-S3Object -BucketName my-bucket -Folder "D:\Testfolder" -Key "****/****" -Recurse
-Credential $AWSCreds -Region us-east-1.
Write-S3Object : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Write-S3Object -BucketName teamsite-s3 -Folder "D:\Testfolder\" -Key ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Write-S3Object], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Amazon.PowerShell.Cmdlets.S3.WriteS3ObjectCmdlet
答案 0 :(得分:0)
已通过使用参数-Keyprefix
而不是-Key
来解决此问题
这不起作用
Write-S3Object -BucketName my-bucket -Folder "D:\Testfolder" -Key "****/****" -Recurse -Credential $AWSCreds -Region us-east-1.
这有效
Write-S3Object -BucketName my-bucket -Folder "D:\Testfolder" -Keyprefix "****/****" -Recurse -Credential $AWSCreds -Region us-east-1.