How to exclude multiple folders while using aws s3 syn ?
I tried :
# aws s3 sync s3://inksedge-app-file-storage-bucket-prod-env s3://inksedge-app-file-storage-bucket-test-env --exclude 'reportTemplate/* orders/* customers/*'
But still it's doing sync for folder "customer"
Output :
copy: s3://inksedge-app-file-storage-bucket-prod-env/customers/116/miniimages/IMG_4800.jpg to s3://inksedge-app-file-storage-bucket-test-env/customers/116/miniimages/IMG_4800.jpg
copy: s3://inksedge-app-file-storage-bucket-prod-env/customers/116/miniimages/DSC_0358.JPG to s3://inksedge-app-file-storage-bucket-test-env/customers/116/miniimages/DSC_0358.JPG
For those who are looking for sync some subfolder in a bucket, the exclude filter applies to the files and folders inside the folder that is be syncing, and not the path with respect to the bucket, example:
would sync the folder bootstrap/css but not bootstrap/js neither bootstrap/fonts in the following folder tree:
That is, the filter is 'css/*' and not 'bootstrap/css/*'
More in https://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters
From a Windows command prompt, only double quote works so use " " around wildcards, eg:
Single quote doesn't work (as tested with the --dryrun option) on Windows 10.
At last this worked for me:
Hint: especially you have to enclose your wildcards and special characters in single or double quotes to work properly, below are example of matching characters. for more information regarding S3 commands, check it in amazon here.