title: AWS S3 sync --delete, removed new files in local
body: <p><code>aws s3 sync --delete</code> removed some new files.</p>
  
  <p>For example: </p>
  
  <p>There is a file in the bucket - <code>S3://my-bucket/images/1.jpg</code></p>
  
  <p>Then, I uploaded a file to the server: <code>2.jpg</code></p>
  
  <p>There are 2 files in the server: <code>1.jpg</code> and <code>2.jpg</code></p>
  
  <p>Start running the sync cronjob:</p>
  
  <pre><code>aws s3 sync s3://my-bucket/ ./ --delete
  aws s3 sync  ./ s3://my-bucket/ --delete
  </code></pre>
  
  <hr>
  
  <p>Why do we add <code>--delete</code> - we want to delete the files in s3 and sync it to the server.</p>
  
  <p>We will upload files to the server and remove the files in s3.</p>
  
  <p>Is there any way to fix it?</p>