justaguy
justaguy

Reputation: 3022

aws sync exclude not excluding all files

The below aws sync command does execute, but I can not seem to exclude the xxxx files as that have the --include pattern in them. It will always be xxxx but I am trying to exclude them from the sync. Thank you :).

files in directory

xxxx.id.1.bam
xxxx.id.1.bai
aaa.id.1.bam
aaa.id.1.bai
bbb.bam
bbb.bai

desired

aaa.id.1.bam
aaa.id.1.bai

command

aws s3  sync . s3://bucket/ --exclude "*" --exclude "*xxxx" --include "*.id.1.bam" --include "*.id.1.bai" --dryrun

Upvotes: 1

Views: 451

Answers (1)

Marcin
Marcin

Reputation: 238957

The order of --exclude and --include metters. It should be:

aws s3  sync . s3://bucket/ --exclude "*"  --include "*.id.1.bam" --include "*.id.1.bai" --exclude "xxxx.*" --dryrun 

Upvotes: 2

Related Questions