Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a local directory that I would like to synchronize with an S3 bucket. I have two specific requirements:

  1. If local file is the same as the remote, do not re-transfer it to the bucket.
  2. If some files or directories exist in the bucket but do not exist on local, delete them. Basically the bucket should mirror the local copy and not vice-versa.

I looked into s3cmd sync command, but unfortunately requirement 2 is not fulfilled. If files exists in the bucket but not on local copy, they will be copied to the local instead of being deleted.

share|improve this question
    
I hear scripts are good for handling simple tasks like this. Perhaps you could write a script to this for you. –  HopelessN00b Nov 17 '12 at 21:10

1 Answer 1

up vote 1 down vote accepted

I finally found an answer by looking further in the s3cmd manual. It turns out that there are options that alter the behaviour of the commands. One option is --delete-removed which alters sync in the way I want:

--delete-removed

         Delete remote objects with no corresponding local file [sync]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.