Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+9 votes
2 views
in AWS by (1.5k points)

I am unable to copy some files from a S3 bucket in AWS CLI

Adding * to the path is not helping:

aws s3 cp s3://personalfiles/file* 

Please help

1 Answer

+11 votes
by (10.5k points)
edited by
  • You can use 3 high-level S3 commands that are inclusive, exclusive and recursive.
  • --include and --exclude are used to specify rules that filter the objects or files to be copied during the sync operation or if they have to be deleted 
  • Using recursive command on a file or directory, the command walks the directory tree including all the sub-directories

Syntax:

--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 comand

Syntax:

aws s3 cp /tmp/foo/ s3://bucketfiles/ --recursive --exclude "*" --include "*.jpg"

  • Try the coded provided below:

aws s3 cp s3://personalfiles/ . --recursive --exclude "*" --include "file*”

Learn more about AWS by going through AWS course and master this trending technology.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...