gsutil 上传单个文件并创建其父文件

gsutil upload single file and create its parents

在脚本中使用 gsutil 需要上传文件并创建其所有父文件。

这是我找到的(丑陋的)唯一解决方案

 gsutil cp -r ./p0/p1/p2/my_file  gs://my_bucket/p0/p1/p2

我在找

gsutil cp -? ./p0/p1/p2/my_file  gs://my_bucket/

在 gs 存储桶中创建 /p0/p1/p2 结构。

gsutil cp /path/to/my_file gs://foo/bar/my_file 应该能满足您的需求。