且构网

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

将gsutil输出传递到文件

更新时间:2023-10-07 08:55:22

您可以使用-L选项生成所有已复制文件的清单文件.来自文档:

You can use the -L option to generate a manifest file of all files that were copied. From the documentation:

-L< file>输出清单日志文件,其中包含有关复制的每个项目的详细信息.此清单包含以下内容 每个项目的信息:

-L <file> Outputs a manifest log file with detailed information about each item that was copied. This manifest contains the following information for each item:

  • 源路径.
  • 目的地路径.
  • 源大小.
  • 已传输字节.
  • MD5哈希.
  • UTC日期和时间传输以ISO 8601格式开始.
  • UTC日期和时间传输已以ISO 8601格式完成.
  • 上传ID(如果已执行可恢复的上传).
  • 尝试上传,成功或失败的最终结果.
  • 故障详细信息,如果有的话.
  • Source path.
  • Destination path.
  • Source size.
  • Bytes transferred.
  • MD5 hash.
  • UTC date and time transfer was started in ISO 8601 format.
  • UTC date and time transfer was completed in ISO 8601 format.
  • Upload id, if a resumable upload was performed.
  • Final result of the attempted upload, success or failure.
  • Failure details, if any.

一个具体示例:

$ echo "hey" | gsutil cp -L manifest.txt - gs://mybucket/hey.txt
Copying from <STDIN> [Content-Type=application/octet-stream]...

$ cat manifest.txt 
Source,Destination,Start,End,Md5,UploadId,Source Size,Bytes Transferred,Result,Description
file://-,gs://mybucket/hey.txt,2013-05-29T21:29:31.847715Z,2013-05-29T21:29:32.115624Z,081ecc5e6dd6ba0d150fc4bc0e62ec50,,,0,OK,