I'm trying to create a folder in my AWS bucket and to upload all image files from a local storage. Unfortunately I have tried all possible commands given in the documentation such as the ones below, but none of them are working.
aws s3 cp C:\mydocs\images s3://bucket.pictures --recursive --include ".jpeg"
aws s3api put-object --bucket bucket.images --key mykey dir-images/
Also attaching a picture which ilustrates the 2 commands that I want to perform, but from the backend with the help of AWS CLI.
Could you please help me write the correct command in AWS CLI?
CodePudding user response:
The following works for me on Windows and recursively copies all JPEG files:
aws s3 cp c:\mydocs\images\ s3://mybucket/images/ --recursive --exclude * --include *.jpeg
Note that you have to exclude all files and then include the files of interest (*.jpeg). If you don't use --exclude *
, you'll get all files, regardless of extension.