How to count number of file in a bucket-folder with gsutil

后端 未结 3 457
被撕碎了的回忆
被撕碎了的回忆 2020-12-24 05:51

Is there an option to count the number of files in bucket-folders?

Like:

gsutil ls -count -recursive gs://bucket/folder

Result:   666 files
         


        
3条回答
  •  温柔的废话
    2020-12-24 06:33

    You want to gsutil ls -count -recursive in gs://bucket/folder? Alright; gsutil ls gs://bucket/folder/** will list just full urls of the paths to files under gs://bucket/folder without the footer or the lines ending in a colon. Piping that to wc -l will give you the line-count of the result.

    gsutil ls gs://bucket/folder/** | wc -l

提交回复
热议问题