I would like to know how I can list all files in my s3 bucket. I need to find files that contain a certain number within its name (eg fillertext-123456-morefillertext.gsm). The files are stored in a sort of calendar arrangement, eg:
bucket_name/region/year/month/day/the_files
I only need to search three specific years and going into every folder/subfolder/another_subfolder through every day of 3 years is just ridiculous. So I want to know if there is a way to list at least each year's files so I can do a cheeky ctrl+f to search through that bigger list. It would save me a lot of time and clicking:).
I have tried using the following code in the aws cloudshell, but I am met with this error: bash: s3: command not found
The command: s3 ls s3://bucket_name/folder/region/company/year/ --recursive --human-readable --summarize
If you want a "flat" listing of the bucket (without having to list every subfolder), you can use:
aws s3api list-objects --bucket BUCKET-NAME --query 'Contents[].[Key]' --output text
It will give an output like:
city/x.csv
copy.cer
flow/users.csv
foo3/dodo
foo3/dodo2
lines.txt
lines2.txt
one/a.py
one/b.py
one/two/c.py
output/sub/x.txt
output/x2.txt
roadsign.jpg
The full paths are provided.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.