How do we select the entire contents of a bucket (all images), and bulk copy URL list for all the objects?

0

How do we select the entire contents of a bucket, and bulk copy URL list for all the objects? Or generate a CSV with all of the URL's for every object in the bucket?

已提問 2 年前檢視次數 896 次
2 個答案
0

You can't do it with S3 features alone.

But you can get a list of objects using S3's advanced API.
list-objects-v2 — AWS CLI 2.5.8 Command Reference

Then, you can format the acquired list into an easy-to-use form using another module such as jq.

$ aws s3api list-objects-v2 --bucket bucketname | jq -r '.Contents[] | ["s3://bucketname/" + .Key] | @csv'
"s3://bucketname/html/API_AddTags.md.html"
"s3://bucketname/html/API_AlgorithmSpecification.md.html"
"s3://bucketname/html/API_AlgorithmStatusDetails.md.html"
"s3://bucketname/html/API_AlgorithmStatusItem.md.html"
"s3://bucketname/html/API_AlgorithmSummary.md.html"
"s3://bucketname/html/API_AlgorithmValidationProfile.md.html"
"s3://bucketname/html/API_AlgorithmValidationSpecification.md.html"
:
profile picture
專家
iwasa
已回答 2 年前
0

yes you can do it by using this command this will create a csv file with two column first is file name and the second is Object _url

*** **for /f "tokens=2 delims=/" %a in ('aws s3 ls s3://bucketName/anyfolderif/ --recursive --region ap-northeast-1 ^| findstr ".aac$"') do echo %a,https://bucketName.s3.ap-northeast-1.amazonaws.com/anyfolderif/%a >> s3_urls.csv ***** You have to set your region this is my region (ap-northeast-1)
and if it not work then you have to install AWS CLI tool, https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html After installation do aws configure in your cmd(command prompt) it ask some key and secret key pin that you go through to any youtube video After configuration use the command that I give you in the first Remember that place you bucket_name or in you bucket have any folder then place the folder name to anyfolderif or one more change you region after that You can crate a csv file if you have a million of data or a short data nothing matter it create a csv file according to data

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南