If you want to synchronizes the content of s3 bucket with a directory it is possible with 's3 sync' command. It also work with the contents of two buckets. Sync command will copy all the files to S3 and sycn it to the local directory without deleting any files.
--delete object with sync command is used to delete the files from the destination directory and not present in the source directory.
Syntax:
$ aws s3 sync [--options]
Example:
The local directory have some files in a directory "DIST" The destination AWS s3 bucket has the contents of some files,
Use the s3 sync and --delete option with the command:
aws s3 sync DIST s3://bucket_name/DESTINATION_DIRECTORY/ --delete
Here the local directory is the source and the AWS S3 bucket is the destination.
The destination has different contents originally than the local directory (source), the text4.txt is deleted!
Comments (0)