Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

Seems so simple, but not getting the syntax right. I want to know if a file exists in my s3 bucket using wildcards. Something like:

aws s3 ls s3://my-bucket/folder/*myfile*

The goal is to see if a file called 2016_myfile.txt or a file called 2011_myfile.csv exists within this bucket.

If I run the command, it doesn't return anything even though I know this file exists there.

1 Answer

0 votes
by (44.4k points)

You can simply use grep for doing this:

aws s3 ls s3://my-bucket/folder/ | grep myfile

Or you can also write a shell script or a python script to do this, but not in a single line.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...