0 votes
1 view
in AWS by (9.4k points)

I have some files that I want to copy to s3. Rather than doing one call per file, I want to include them all in one single call (to be as efficient as possible).

However, I only seem to get it to work if I add the --recursive flag, which makes it look in all children directories (all files I want are in the current directory only)

so this is the command I have now, that works

aws s3 cp --dryrun . mybucket --recursive --exclude * --include *.jpg

but ideally I would like to remove the --recursive to stop it traversing, e.g. something like this (which does not work)

aws s3 cp --dryrun . mybucket --exclude * --include *.jpg

(I have simplified the example, in my script I have several different include patterns)

1 Answer

0 votes
by (18.6k points)

You can use --include and --exclude parameters to achieve this. Make note of the order of --include and --exclude as the order matters.

Try the following command:

aws s3 cp --dryrun . s3://mybucket --recursive --exclude "*" --include "*.jpg" --exclude "*/*"

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

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...