Created
September 30, 2024 01:07
-
-
Save tecmaverick/b34aad5e83a9b57e0874483bcc86e823 to your computer and use it in GitHub Desktop.
AWS CLI - S3 List File Extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Retrieves the list of unique file extensions, including those with multiple extensions like gz.txt | |
aws s3 ls s3://the_bucket_name/prefix_name --recursive | rev | cut -d "/" -f 1 | rev | cut -d "." -f 2- | sort | uniq | |
# Retrieves the count of file extensions in a given s3 prefix | |
aws s3 ls s3://the_bucket_name/prefix_name --recursive | rev | cut -d "/" -f 1 | rev | cut -d "." -f 2- | uniq -c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment