Is it possible to retrieve the number of folders in S3?
For example,when configuring
I would like to retrieve the number of folders as shown in .
I was able to get the file count information with the following code:
I don't know how to get folder information only.
I would appreciate your help.ruby-on-rails ruby aws amazon-s3
Ruby's own code doesn't come out at all, so please let me know your policy.
If you look at the pages above, you can see that api in awss3 can retrieve the next layer of data from prefix by listing object with delimiter and prefix.
I think it would be better to use aws-sdk-s3 to list_objects under the following conditions.(Not verified)
S3 does not have the concept of a folder, so you can count the unique names by considering the key you get as a file name and taking out the parts you want to treat as folders, such as
© 2022 OneMinuteCode. All rights reserved.