Does rsync delete files on the destination that were deleted from the sending side?












11















Does rsync delete files from the destination if they were deleted from the source?



For example, say in the source /home/me I have three files:



a.txt
b.txt
c.txt


Now, I run the command rsync -v /home/me/ user@ip.address:/home/backup and it copies files a.txt, b.txt and c.txt to /home/backup.



The contents of /home/backup are now



a.txt
b.txt
c.txt


If I were to delete a.txt from /home/me, would a.txt get deleted from /home/backup the next time I run rsync, is there an option I need to specify or is it just completely impossible?



If there are any alternatives to rsync that do this, they are welcome as well.



Side note: I have read this and this relating to this topic, but I couldn't exactly understand or see how it was exactly related to the question.










share|improve this question





























    11















    Does rsync delete files from the destination if they were deleted from the source?



    For example, say in the source /home/me I have three files:



    a.txt
    b.txt
    c.txt


    Now, I run the command rsync -v /home/me/ user@ip.address:/home/backup and it copies files a.txt, b.txt and c.txt to /home/backup.



    The contents of /home/backup are now



    a.txt
    b.txt
    c.txt


    If I were to delete a.txt from /home/me, would a.txt get deleted from /home/backup the next time I run rsync, is there an option I need to specify or is it just completely impossible?



    If there are any alternatives to rsync that do this, they are welcome as well.



    Side note: I have read this and this relating to this topic, but I couldn't exactly understand or see how it was exactly related to the question.










    share|improve this question



























      11












      11








      11


      3






      Does rsync delete files from the destination if they were deleted from the source?



      For example, say in the source /home/me I have three files:



      a.txt
      b.txt
      c.txt


      Now, I run the command rsync -v /home/me/ user@ip.address:/home/backup and it copies files a.txt, b.txt and c.txt to /home/backup.



      The contents of /home/backup are now



      a.txt
      b.txt
      c.txt


      If I were to delete a.txt from /home/me, would a.txt get deleted from /home/backup the next time I run rsync, is there an option I need to specify or is it just completely impossible?



      If there are any alternatives to rsync that do this, they are welcome as well.



      Side note: I have read this and this relating to this topic, but I couldn't exactly understand or see how it was exactly related to the question.










      share|improve this question
















      Does rsync delete files from the destination if they were deleted from the source?



      For example, say in the source /home/me I have three files:



      a.txt
      b.txt
      c.txt


      Now, I run the command rsync -v /home/me/ user@ip.address:/home/backup and it copies files a.txt, b.txt and c.txt to /home/backup.



      The contents of /home/backup are now



      a.txt
      b.txt
      c.txt


      If I were to delete a.txt from /home/me, would a.txt get deleted from /home/backup the next time I run rsync, is there an option I need to specify or is it just completely impossible?



      If there are any alternatives to rsync that do this, they are welcome as well.



      Side note: I have read this and this relating to this topic, but I couldn't exactly understand or see how it was exactly related to the question.







      rsync backup






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '17 at 12:36









      Community

      1




      1










      asked Dec 18 '15 at 4:25









      perhapsmaybeharryperhapsmaybeharry

      3281216




      3281216






















          1 Answer
          1






          active

          oldest

          votes


















          25














          Only if you… select one of the delete options. See man rsync for more information, but here is an excerpt:



          --delete                delete extraneous files from dest dirs
          --delete-before receiver deletes before xfer, not during
          --delete-during receiver deletes during the transfer
          --delete-delay find deletions during, delete after
          --delete-after receiver deletes after transfer, not during
          --delete-excluded also delete excluded files from dest dirs


          There is more detailed information for these options further down the man page.






          share|improve this answer


























          • Just to confirm, this means that if I select --delete, rsync would delete files from the destination that were deleted from the source, making the source and destination an exact mirror?

            – perhapsmaybeharry
            Dec 18 '15 at 4:30






          • 3





            Yes, but just have a read of the man page! There are caveats and hints, including running it with --dry-run.

            – Sparhawk
            Dec 18 '15 at 4:32











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f250118%2fdoes-rsync-delete-files-on-the-destination-that-were-deleted-from-the-sending-si%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          25














          Only if you… select one of the delete options. See man rsync for more information, but here is an excerpt:



          --delete                delete extraneous files from dest dirs
          --delete-before receiver deletes before xfer, not during
          --delete-during receiver deletes during the transfer
          --delete-delay find deletions during, delete after
          --delete-after receiver deletes after transfer, not during
          --delete-excluded also delete excluded files from dest dirs


          There is more detailed information for these options further down the man page.






          share|improve this answer


























          • Just to confirm, this means that if I select --delete, rsync would delete files from the destination that were deleted from the source, making the source and destination an exact mirror?

            – perhapsmaybeharry
            Dec 18 '15 at 4:30






          • 3





            Yes, but just have a read of the man page! There are caveats and hints, including running it with --dry-run.

            – Sparhawk
            Dec 18 '15 at 4:32
















          25














          Only if you… select one of the delete options. See man rsync for more information, but here is an excerpt:



          --delete                delete extraneous files from dest dirs
          --delete-before receiver deletes before xfer, not during
          --delete-during receiver deletes during the transfer
          --delete-delay find deletions during, delete after
          --delete-after receiver deletes after transfer, not during
          --delete-excluded also delete excluded files from dest dirs


          There is more detailed information for these options further down the man page.






          share|improve this answer


























          • Just to confirm, this means that if I select --delete, rsync would delete files from the destination that were deleted from the source, making the source and destination an exact mirror?

            – perhapsmaybeharry
            Dec 18 '15 at 4:30






          • 3





            Yes, but just have a read of the man page! There are caveats and hints, including running it with --dry-run.

            – Sparhawk
            Dec 18 '15 at 4:32














          25












          25








          25







          Only if you… select one of the delete options. See man rsync for more information, but here is an excerpt:



          --delete                delete extraneous files from dest dirs
          --delete-before receiver deletes before xfer, not during
          --delete-during receiver deletes during the transfer
          --delete-delay find deletions during, delete after
          --delete-after receiver deletes after transfer, not during
          --delete-excluded also delete excluded files from dest dirs


          There is more detailed information for these options further down the man page.






          share|improve this answer















          Only if you… select one of the delete options. See man rsync for more information, but here is an excerpt:



          --delete                delete extraneous files from dest dirs
          --delete-before receiver deletes before xfer, not during
          --delete-during receiver deletes during the transfer
          --delete-delay find deletions during, delete after
          --delete-after receiver deletes after transfer, not during
          --delete-excluded also delete excluded files from dest dirs


          There is more detailed information for these options further down the man page.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 31 mins ago

























          answered Dec 18 '15 at 4:28









          SparhawkSparhawk

          10.1k64397




          10.1k64397













          • Just to confirm, this means that if I select --delete, rsync would delete files from the destination that were deleted from the source, making the source and destination an exact mirror?

            – perhapsmaybeharry
            Dec 18 '15 at 4:30






          • 3





            Yes, but just have a read of the man page! There are caveats and hints, including running it with --dry-run.

            – Sparhawk
            Dec 18 '15 at 4:32



















          • Just to confirm, this means that if I select --delete, rsync would delete files from the destination that were deleted from the source, making the source and destination an exact mirror?

            – perhapsmaybeharry
            Dec 18 '15 at 4:30






          • 3





            Yes, but just have a read of the man page! There are caveats and hints, including running it with --dry-run.

            – Sparhawk
            Dec 18 '15 at 4:32

















          Just to confirm, this means that if I select --delete, rsync would delete files from the destination that were deleted from the source, making the source and destination an exact mirror?

          – perhapsmaybeharry
          Dec 18 '15 at 4:30





          Just to confirm, this means that if I select --delete, rsync would delete files from the destination that were deleted from the source, making the source and destination an exact mirror?

          – perhapsmaybeharry
          Dec 18 '15 at 4:30




          3




          3





          Yes, but just have a read of the man page! There are caveats and hints, including running it with --dry-run.

          – Sparhawk
          Dec 18 '15 at 4:32





          Yes, but just have a read of the man page! There are caveats and hints, including running it with --dry-run.

          – Sparhawk
          Dec 18 '15 at 4:32


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f250118%2fdoes-rsync-delete-files-on-the-destination-that-were-deleted-from-the-sending-si%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Loup dans la culture

          How to solve the problem of ntp “Unable to contact time server” from KDE?

          ASUS Zenbook UX433/UX333 — Configure Touchpad-embedded numpad on Linux