Aws-s3 cp errors on --exclude argument

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

version: 2.1

  aws-cli: circleci/aws-cli@4.1.2
  aws-s3: circleci/aws-s3@4.0.0
      - image: cimg/base:current
      - checkout
      - aws-cli/setup:
          role_arn: arn:aws:iam::123456789:role/circleci-role
      - aws-s3/copy:
          arguments: |
              --recursive \
              --exclude ".git*" \
              --exclude ".circleci*" \
              --exclude ""
          from: ./
          to: s3://

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

+ aws s3 cp ./ s3:// --profile default --recursive '\
--exclude' '"*.git*"' '\
--exclude' '"*.circleci*"' '\
--exclude' '"*"'

Unknown options: \

Exited with code exit status 252

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

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.

1 Like

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

--exclude' ''\''.git*'\''' '\
--exclude' ''\''.circleci*'\''' '\
--exclude' ''\'''\'''

Unknown options: \

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

      - run:
          name: Copy to S3 Bucket Using AWS CLI 
          command: aws s3 cp ./ s3:// --recursive --include "*" --exclude ".git*" --exclude ".circleci*"  --exclude ""

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.