2

How can I include the _ (underscore) on the include pattern?

I have a S3 bucket with files with the following format

20220630_084021_abc.json
20220630_084031_def.json
20220630_084051_ghi.json
20220630_084107_abc.json
20220630_084118_def.json

So, I would like to get all the files that start with 20220630_0840*. So, I've tried to fetch them using multiple variations on the include pattern, so far I had used the followings:

 aws s3 cp s3://BUCKET/ LocalFolder  --include "20220630_0840*" --recursive
 aws s3 cp s3://BUCKET/ LocalFolder  --include "[20220630_0840]*" --recursive
 aws s3 cp s3://BUCKET/ LocalFolder  --include "20220630\_0840*" --recursive

None of them really work I'm getting all the files that have their name starting with 20220630

fingerprints
  • 2,751
  • 1
  • 25
  • 45
  • 2
    Use `--exclude="*" --include "*/20220630_0840*"` – Anon Coward Jun 30 '22 at 14:59
  • Check my answer - https://stackoverflow.com/a/73766516/5285732 you can use rclone to sync/copy dirs according to patterns. In my answer I explained how to list the dirs, though if you read the docs a bit, you'll see that it's quite intuitive to use rclone – Meir Gabay Oct 05 '22 at 21:19

0 Answers0