How to deploy AWS S3 cp wildcards to copy a group of files in AWS CLI?

111    Asked by DianaCampbell in AWS , Asked on Aug 2, 2023
I cannot copy few files from s3 bucket in AWS CLI
Including * to the path is useless
Aws s3 cp s3 :// personalfiles/file*

So how to use aws s3 cp wildcard?

Answered by Elizabeth Clarke

Wildcards refer to the unique characters in the AWS CLI Commands that let the user make certain patterns in their commands. The cp command copies the files from the regional directory to the cloud. If you wish to download several files from aws bucket to the present directory, then you may utilize recursive, exclude, and include flags. The sequence of the parameters is crucial. The exclude and include must be deployed in a certain sequence. First we need to exclude and then include.

3 top-level S3 commands can be used - inclusive, exclusive, and recursive.

– – include and – – exclude are meant to denote rules that filter the files that must be copied during the sync task or if they need to be erased. REcursive command compels the command to walk the directory tree along with the subdirectories.
- exclude “*” – – include “*.txt” All files will be excluded from the command except for files ending with .txt
- include “*.txt - - exclude “*” All files will be excluded from the command.
Aws s3 cp /tmo/foo/ s3:// bucketfiles/ - - recursive - - exclude “*” - - include “*.jpg”
You can try the below-mentioned code
Aws s3 cp s3 : // personalfiles / . - - recursive - - exclude “*” - - include “file*”

The AWS Solution Architect Online Training provided at JanBask Training comprises skilled instructors with unique learning delivery techniques that guarantee that the candidates learn and grasp the concepts well. The instructors also motivate the practical utilization of the course to make the concepts more apparent and clear. They teach you the basic to advanced concepts elaborately to help you develop potent strategies so that businesses can shift the information on cloud storage with proper security. They make you job-ready to face the challenging job market scenario.

Your Answer


Parent Categories