Sync data from s3 to local with specific suffix

Viewed 109

I am trying to sync data from s3 to local with specific suffix using aws-cli.

All files in S3

EUACCESS_Details_20210906100000
ZSMART_Details
INHOME_Details_20211206100023
EUACCESS_Details_202101021003000
INHOME_Details_20211006100000
full_order_overview_20211006100000

output:

EUACCESS_Details_20210906100000
INHOME_Details_20211206100023
EUACCESS_Details_202101021003000
INHOME_Details_20211006100000

I have tired using this command but i'm getting errors

aws s3 sync s3://ip-managed-s3.crush.order.in/zsmart/EUACCESS_Details_* ./local_folder
aws s3 sync s3://ip-managed-s3.crush.order.in/zsmart/INHOME_Details_* ./local_folder

Is their any simple solution for it.

1 Answers

You can do this with --include and ---exclude:

aws s3 sync s3://ip-managed-s3.crush.order.in/zsmart/ ./local_folder  --exclude "*" --include "EUACCESS_Details_*" --include "INHOME_Details_*"
Related