Exclude multiple folders using AWS S3 sync

前端 未结 3 845
谎友^
谎友^ 2021-02-02 05:43

How to exclude multiple folders while using aws s3 syn ?

I tried :

# aws s3 sync  s3://inksedge-app-file-storage-bucket-prod-env   s3://inksedge-app-file         


        
3条回答
  •  Happy的楠姐
    2021-02-02 06:45

    For those who are looking for sync some subfolder in a bucket, the exclude filter applies to the files and folders inside the folder that is be syncing, and not the path with respect to the bucket, example:

    aws s3 sync s3://bucket1/bootstrap/ s3://bucket2/bootstrap --exclude '*' --include 'css/*'
    

    would sync the folder bootstrap/css but not bootstrap/js neither bootstrap/fonts in the following folder tree:

    bootstrap/
    ├── css/
    │   ├── bootstrap.css
    │   ├── bootstrap.min.css
    │   ├── bootstrap-theme.css
    │   └── bootstrap-theme.min.css
    ├── js/
    │   ├── bootstrap.js
    │   └── bootstrap.min.js
    └── fonts/
        ├── glyphicons-halflings-regular.eot
        ├── glyphicons-halflings-regular.svg
        ├── glyphicons-halflings-regular.ttf
        └── glyphicons-halflings-regular.woff
    

    That is, the filter is 'css/*' and not 'bootstrap/css/*'

    More in https://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters

提交回复
热议问题