• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Contact
  • Archives
  • Search

AWS CLI S3 Recursive Copy

February 2, 2020 by Ulysses

Here’s how to copy multiple files recursively using AWS CLI. The S3 cp command by default only copies a single file. To copy multiple files, you have to use the –recursive option along with –exclude and –include. In this example, we will exclude every file, but include only files with a json extension.

aws s3 cp /tmp/folder s3://bucket/folder \
  --recursive
  --exclude "*"
  --include "*.json"

aws s3 cp /tmp/folder s3://bucket/folder \ --recursive --exclude "*" --include "*.json"

The result:

upload: ./abc.json to s3://bucket/folder/abc.json    
upload: ./xyz.json to s3://bucket/folder/xyz.json

upload: ./abc.json to s3://bucket/folder/abc.json upload: ./xyz.json to s3://bucket/folder/xyz.json

Filed Under: Cloud Tagged With: aws, cp, exclude, files, include, multiple, recursive, s3

Search The Website

Subscribe Via Email

Copyright © 2022