[英]Granting permission to ALL objects in a bucket via AWS Powershell Tools?
I can grant specific permissions to a specific file easily, like this:我可以轻松地向特定文件授予特定权限,如下所示:
Set-S3ACL -BucketName "bucket" -Key "file.txt"
However, now I'm trying to do it for all the files:但是,现在我正在尝试对所有文件执行此操作:
Set-S3ACL -BucketName "bucket" -Key "*"
This does not work and it throws:这不起作用,它会抛出:
Set-S3ACL : The specified key does not exist.
What is the valid syntax in this case?这种情况下的有效语法是什么?
If you need to recursively apply the function to every file, you can achieve that with Get-ChildItem
to get all of the files in a folder, and using Recurse
to also search subfolders.如果您需要递归地将 function 应用于每个文件,您可以使用
Get-ChildItem
来获取文件夹中的所有文件,并使用Recurse
来搜索子文件夹。 Then loop those results and call the function for each one.然后循环这些结果并为每个结果调用 function。
Get-ChildItem -Path $topfolder -Recurse | ForEach-object { Set-S3ACL -BucketName "bucket" -Key $_.Name }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.