gsutil 返回“未找到匹配项" [英] gsutil returning "no matches found"

查看:47
本文介绍了gsutil 返回“未找到匹配项"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 gsutil 删除 Cloud Storage 存储分区的内容(但不是存储分区本身).根据文档,命令应该是:

I'm trying using gsutil to remove the contents of a Cloud Storage bucket (but not the bucket itself). According to the documentation, the command should be:

gsutil rm gs://bucket/**

但是,每当我运行它(当然用我的存储桶名称替换)时,我都会收到以下响应:

However, whenever I run that (with my bucket name substituted of course), I get the following response:

zsh:未找到匹配项:gs://my-bucket/**

我已经检查了权限,并且我拥有所有者权限.另外,如果我直接指定bucket中的文件,则删除成功.

I've checked permissions, and I have owner permissions. Additionally, if I specify a file, which is in the bucket, directly, it is successfully deleted.

其他可能重要的信息:

  • 我的存储桶名称中有一个-"(类似于my-bucket")
  • 这是 Cloud Storage 将我的使用日志保存到的存储分区

如何删除存储桶的内容?

How do I go about deleting the contents of a bucket?

推荐答案

zsh 试图在 gsutil 看到它之前扩展通配符(并抱怨您没有与该通配符匹配的本地文件).请尝试这样做,以防止 zsh 这样做:

zsh is attempting to expand the wildcard before gsutil sees it (and is complaining that you have no local files matching that wildcard). Please try this, to prevent zsh from doing so:

gsutil rm 'gs://bucket/**'

请注意,您需要使用单引号(而非双引号)来防止 zsh 通配符处理.

Note that you need to use single (not double) quotes to prevent zsh wildcard handling.

这篇关于gsutil 返回“未找到匹配项"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆