Published on

How to exclude directory in AWS S3 Sync CLI


When you're using sync command in AWS S3 CLI, you might want to exclude some directories.

You can do it by passing --exclude arguments. It supports pattern matching similar to git

For example, if you want to exclude temp directory and all the files inside it.

Here is how to do it:

aws s3 sync /tmp/source/path s3://YOUR_BUCKET_NAME/dest/path --exclude "temp/*"

Happy ignoring files!