google cloud storage - How to count number of file in a bucket-folder with gsutil -
is there option count number of files in bucket-folders?
like:
gsutil ls -count -recursive gs://bucket/folder result: 666 files
i want total number of files compare amount sync-folder on server.
i don't in manual.
the gsutil ls command options -l
(long listing) , -r
(recursive listing) list entire bucket recursively , produce total count @ end:
$ gsutil ls -lr gs://pub 104413 2011-04-03t20:58:02z gs://pub/someoftheteam.jpg 172 2012-06-18t21:51:01z gs://pub/cloud_storage_storage_schema_v0.json 1379 2012-06-18t21:51:01z gs://pub/cloud_storage_usage_schema_v0.json 1767691 2013-09-18t07:57:42z gs://pub/gsutil.tar.gz 2445111 2013-09-18t07:57:44z gs://pub/gsutil.zip 1136 2012-07-19t16:01:05z gs://pub/gsutil_2.0.releasenotes.txt ... <snipped> ... gs://pub/apt/pool/main/p/python-socksipy-branch/: 10372 2013-06-10t22:52:58z gs://pub/apt/pool/main/p/python-socksipy-branch/python-socksipy-branch_1.01_all.deb gs://pub/shakespeare/: 84 2010-05-07t23:36:25z gs://pub/shakespeare/rose.txt total: 144 objects, 102723169 bytes (97.96 mb)
if want total, can pipe output tail
command:
$ gsutil ls -lr gs://pub | tail -n 1 total: 144 objects, 102723169 bytes (97.96 mb)
update
gsutil has du command. makes easier count:
$ gsutil du gs://pub | wc -l 232
Comments
Post a Comment