AWS S3 sync --delete, removed new files in local

后端 未结 3 1851
说谎
说谎 2021-01-01 09:24

aws s3 sync --delete removed some new files.

For example:

There is a file in the bucket - S3://my-bucket/images/1.jpg

Then

相关标签:
3条回答
  • 2021-01-01 09:38

    For the new s3cmd you can use the option --delete-removed to removed extra files in the destination, that are not present the source.

    0 讨论(0)
  • 2021-01-01 09:42

    By default, the aws sync command (see documentation) does not delete files. It simply copies new or modified files to the destination.

    Using the --delete option deletes files that exist in the destination but not in the source.

    So, if your source contains: 1.jpg and 2.jpg and the destination contains 1.jpg, 2.jpg and 3.jpg, then using the --delete option will delete 3.jpg from the destination.

    I see that you are running the sync command in both directions. Your first command (that syncs S3 to a local directory) will delete any local files that are not in S3.

    If your goal is to copy all local files to S3 and all S3 files to the local directory, without deleting any files, then do not use the --delete option.

    0 讨论(0)
  • 2021-01-01 09:48

    --delete option to remove files or objects from the target not present in the source.

    0 讨论(0)
提交回复
热议问题