# Aws-s3 cp errors on --exclude argument

**URL:** <https://discuss.circleci.com/t/aws-s3-cp-errors-on-exclude-argument/50086>\
**Category:** Orbs\
**Tags:** awscli\
**Created:** [December 16, 2023, 3:39pm UTC](https://discuss.circleci.com/t/aws-s3-cp-errors-on-exclude-argument/50086 "2023-12-16T15:39:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![petekofod](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/petekofod/32/27940_2.png) [@petekofod](https://discuss.circleci.com/u/petekofod)\
**Post date:** [December 16, 2023, 3:39pm UTC](https://discuss.circleci.com/t/aws-s3-cp-errors-on-exclude-argument/50086/1 "2023-12-16T15:39:44Z")

</div>

I am trying to run an aws s3 cp using the aws-s3 orb.

```auto
version: 2.1

orbs:
  aws-cli: circleci/aws-cli@4.1.2
  aws-s3: circleci/aws-s3@4.0.0
...
jobs:
  deploy:
    docker:
      - image: cimg/base:current
    steps:
      - checkout
      - aws-cli/setup:
          role_arn: arn:aws:iam::123456789:role/circleci-role
      - aws-s3/copy:
          arguments: |
              --recursive \
              --exclude ".git*" \
              --exclude ".circleci*" \
              --exclude "README.md"
          from: ./
          to: s3://www.abc.com

```

When running it with the --exclude arguments, I get the following error:

```auto
+ aws s3 cp ./ s3://www.abc.com --profile default --recursive '\
--exclude' '"*.git*"' '\
--exclude' '"*.circleci*"' '\
--exclude' '"*README.md"'

Unknown options: \
--exclude,"*.git*",\
--exclude,"*.circleci*",\
--exclude,"*README.md"

Exited with code exit status 252

```

Any idea what I am doing wrong? When I leave the --exclude arguments out, it runs fine.

---

<div class="post-metadata">

**Author:** ![rit1010](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rit1010/32/34738_2.png) [@rit1010](https://discuss.circleci.com/u/rit1010)\
**Post date:** [December 17, 2023, 11:58am UTC](https://discuss.circleci.com/t/aws-s3-cp-errors-on-exclude-argument/50086/2 "2023-12-17T11:58:41Z")

</div>

Try placing single quotes around the values rather than double quotes.

This is a pure guess, but the output you have provided seems to start placing single quotes around the double quotes twice which is either an error with the parser or the print output function.

---

<div class="post-metadata">

**Author:** ![petekofod](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/petekofod/32/27940_2.png) [@petekofod](https://discuss.circleci.com/u/petekofod)\
**Post date:** [December 20, 2023, 9:53pm UTC](https://discuss.circleci.com/t/aws-s3-cp-errors-on-exclude-argument/50086/3 "2023-12-20T21:53:21Z")

</div>

Thank you. I tried your suggestion, but no luck. It complained just the same.

```auto
--exclude' ''\''.git*'\''' '\
--exclude' ''\''.circleci*'\''' '\
--exclude' ''\''README.md'\'''

Unknown options: \
--exclude,'.git*',\
--exclude,'.circleci*',\
--exclude,'README.md'

```

I ended up running it via the aws-cli command which worked fine. Odd.

```auto
      - run:
          name: Copy to S3 Bucket Using AWS CLI 
          command: aws s3 cp ./ s3://www.abc.com --recursive --include "*" --exclude ".git*" --exclude ".circleci*" --exclude "README.md"

```

---

<div class="post-metadata">

**Author:** ![kalpaitch](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/kalpaitch/32/27847_2.png) [@kalpaitch](https://discuss.circleci.com/u/kalpaitch)\
**Post date:** [March 19, 2024, 10:11pm UTC](https://discuss.circleci.com/t/aws-s3-cp-errors-on-exclude-argument/50086/4 "2024-03-19T22:11:59Z")

</div>

I’m getting this error too. A bug either in the documentation or in the orb itself, seemingly both. Can we get a fix for this.

---

<div class="post-metadata">

**Author:** ![johan-ds](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/johan-ds/32/36459_2.png) [@johan-ds](https://discuss.circleci.com/u/johan-ds)\
**Post date:** [June 17, 2025, 7:04am UTC](https://discuss.circleci.com/t/aws-s3-cp-errors-on-exclude-argument/50086/5 "2025-06-17T07:04:55Z")

</div>

I know it’s an old one, but since I came here for the same reason after a quick search, here is the solution :  
After [this PR](https://github.com/CircleCI-Public/aws-s3-orb/pull/54) (merged in 4.0.0) arguments for copy and sync must be onlined  
Documentation should be updated
