Skip to content

Instantly share code, notes, and snippets.

@natanlao
Created October 21, 2021 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natanlao/b14549a211648eebea63f54722a5e5d3 to your computer and use it in GitHub Desktop.
Save natanlao/b14549a211648eebea63f54722a5e5d3 to your computer and use it in GitHub Desktop.
`aws s3 cp`, `aws s3 sync` not excluding/including keys properly

It turns out that the order of the --exclude and --include flags passed to aws s3 sync and aws s3 cp matters, so

aws s3 sync 's3://my-bucket' . --include '*' --exclude '*.png'

won't download anything but

aws s3 sync 's3://my-bucket' . --exclude '*' --include '*.png'

will download all PNGs in the "root" of the bucket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment