Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

aws ls to list only files inside folders with a specific pattern and extension

$
0
0

I have a bucket with several folders, and inside each several files. I just want to list the .tsv files inside those folders that contain the pattern"*report_filtered_count10" in their name.

I can do:

aws s3 ls s3://<my bucket> --recursive

but not:

aws s3 ls s3://<my bucket>/*/*report_filtered_count10.tsv --recursive

My workaround has been to use aws sync and then ls locally, like this:

aws s3 sync s3://<my bucket>/ tsv_files --exclude '*' --include '*report_filtered_count10.tsv'ls tsv_files/*/*.tsv

... and then parse the output.

I also tried this aws sync nomenclature with aws ls, but it does not work either:

aws s3 ls s3://<my bucket>/ --exclude '*' --include '*report_filtered_count10.tsv'

Unknown options: --exclude,*,--include,*report_filtered_count10.tsv

Any idea how to do this simple task? my desired output would be:

s3://<my bucket>/folder1/file1_report_filtered_count10.tsvs3://<my bucket>/folder2/file2_report_filtered_count10.tsvs3://<my bucket>/folder3/file3_report_filtered_count10.tsvs3://<my bucket>/folder4/file4_report_filtered_count10.tsvs3://<my bucket>/folder5/file5_report_filtered_count10.tsv...

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>