且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何以编程方式重命名Google存储中的文件夹?

更新时间:2023-02-10 22:57:20

GCS不支持真正的文件夹-名称空间是平坦的,并且"/"的含义实际上是由客户端(和客户端库)施加的.因此,无法原子地重命名文件夹-您需要重命名每个包含的文件,就像gsutil mv命令一样.您可以通过运行以下命令来查看此信息:

GCS doesn't support true folders -- the namespace is flat, and the meaning of "/" is really imposed by clients (and client libraries). As such, folders can't be renamed atomically - you would need to rename each of the contained files, like what the gsutil mv command does. You can see this by running a command like:

gsutil -d mv gs://my-bucket/folder1 gs://my-bucket/folder2

-d选项将使其输出gsutil进行重命名的请求序列.

The -d option will cause it to output the sequence of requests gsutil generates to do the rename.