繁体   English   中英

将大量文件从Google云端存储复制到Google Colab,而无需进行日志/打印

[英]Copying large number of files from Google Cloud Storage to Google Colab without logging/printing

我将大量图像(.jpg)存储在Google云存储中,希望在Google Colab中使用。

为此我使用(在谷歌Colab中)

GCS_PATH = "gs://bucket/prefix"
!gsutil -m cp -r {GCS_PATH} ./data

但是,运行时,Google colab会将每次传输打印到单元的输出,这会使我的浏览器变慢。 我想知道gsutil cp是否有--quiet或--silent标志。 我检查了gsutil help cp但找不到任何东西。

如果运行gsutil help options ,您会发现它具有一个顶级的-q标志,该标志应该可以执行您想要的操作:

-q          Causes gsutil to perform operations quietly, i.e., without
            reporting progress indicators of files being copied or removed,
            etc. Errors are still reported. This option can be useful for
            running gsutil from a cron job that logs its output to a file, for
            which the only information desired in the log is failures.

而且,如果您绝对不想输出任何信息,则可以始终将stdout和stderr重定向到一个单独的文件(例如,在大多数* nix系统上,这看起来像somecommand >/dev/null 2>&1 ,但我不确定该从顶部开始)我的脑海中有什么文件/设备由Colab授予您写入权限)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM