How can I tell how many objects I've stored in an S3 bucket?

后端 未结 29 3793
逝去的感伤
逝去的感伤 2020-12-02 04:45

Unless I\'m missing something, it seems that none of the APIs I\'ve looked at will tell you how many objects are in an /. Is ther

29条回答
  •  不知归路
    2020-12-02 05:28

    If you use the s3cmd command-line tool, you can get a recursive listing of a particular bucket, outputting it to a text file.

    s3cmd ls -r s3://logs.mybucket/subfolder/ > listing.txt
    

    Then in linux you can run a wc -l on the file to count the lines (1 line per object).

    wc -l listing.txt
    

提交回复
热议问题