How do I make rsync delete files that have been deleted from the source folder?How to automatically archive a directory?Get a list of deleted files from rsyncScript for an incremental file system backupHow to exclude files in rsync?Simple rsync incremental backup that timestamps deleted filesrsync --delete option not deleting in destination if deleted in sourceI want to rsync files older than 2 days, syncs all files insteadRsync, --delete not remove files on targetrsync from unmounted webdav sourceHow to delete a proportion of files?

Did "The Legend of Zelda: Majora's Mask" use a battery for keeping the save files after all?

Why do aircraft cockpit displays use uppercase fonts?

What Lego set has the biggest box?

Why is there a preference to use the cumulative distribution function to characterise a random variable instead of the probability density function?

What graphics sytems used display lists?

What does it mean to play in a mode?

How to prevent discontent among the players when one player murders the others' characters?

Is it possible for nature to create bubble wrap?

How did 達 (~tachi) come to mean `pluralize` something?

Should trigger handlers be static or non-static?

Declining a paper review after accepting it and seeing the manuscript

Does the production of a Tesla battery produce as much CO2 as driving 200,000 km?

Unexpected large rent payments, by moneygram, for my apartment, not by me

A trivial proof of Bertrand's postulate

How to calculate my anticipated peak amperage load?

What is the density of supercooled LOX at −206 °C, as SpaceX uses it

Can we use a Cryptographic hash function to generate infinite random numbers?

Is it appropriate to ask for the text of a eulogy?

Any real contribution of functional analysis to quantum theory as a branch of physics?

What does "x employee is no longer employed by XYZ company" mean?

Blender Python and pass settings

A Plethora of Puzzled Pawns

Longest Prime Sums

Secure Implementation of Password Database



How do I make rsync delete files that have been deleted from the source folder?


How to automatically archive a directory?Get a list of deleted files from rsyncScript for an incremental file system backupHow to exclude files in rsync?Simple rsync incremental backup that timestamps deleted filesrsync --delete option not deleting in destination if deleted in sourceI want to rsync files older than 2 days, syncs all files insteadRsync, --delete not remove files on targetrsync from unmounted webdav sourceHow to delete a proportion of files?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









211


















I recently set up a machine with Ubuntu Server to host game servers. I installed a backup plugin for each game server that creates frequent backups of game world files in a particular folder on the machine. I also established a cron task to automatically copy those backups to my Dropbox folder every night using rsync with the -a option.



After a few months my Dropbox account reached its storage limit and I realized I would not be able to keep so many backups, so I configured the game server backup plugin to not retain so many backups, then waited a few days to see if it would delete the older backups as it is scheduled to do on a weekly basis. The backup plugin eventually did its job and deleted the older backups, so I was expecting the rsync cron task to subsequently delete the older backups from my Dropbox folder to match the source folder, but it has not done so. So I have a couple of questions:



  • By default, does rsync only add files to the destination folder
    that have been added to the source folder and change files that
    have been changed in the source folder but NOT delete files
    that were deleted from the source folder?


  • If that is the case, what is the best way to make rsync do this? I
    want the destination folder to perfectly reflect the source folder,
    and that means deleting any files that have been deleted from the source
    folder.


I see some options listed in the manual page for rsync that might do the trick, but since I'm not familiar with.










share|improve this question

































    211


















    I recently set up a machine with Ubuntu Server to host game servers. I installed a backup plugin for each game server that creates frequent backups of game world files in a particular folder on the machine. I also established a cron task to automatically copy those backups to my Dropbox folder every night using rsync with the -a option.



    After a few months my Dropbox account reached its storage limit and I realized I would not be able to keep so many backups, so I configured the game server backup plugin to not retain so many backups, then waited a few days to see if it would delete the older backups as it is scheduled to do on a weekly basis. The backup plugin eventually did its job and deleted the older backups, so I was expecting the rsync cron task to subsequently delete the older backups from my Dropbox folder to match the source folder, but it has not done so. So I have a couple of questions:



    • By default, does rsync only add files to the destination folder
      that have been added to the source folder and change files that
      have been changed in the source folder but NOT delete files
      that were deleted from the source folder?


    • If that is the case, what is the best way to make rsync do this? I
      want the destination folder to perfectly reflect the source folder,
      and that means deleting any files that have been deleted from the source
      folder.


    I see some options listed in the manual page for rsync that might do the trick, but since I'm not familiar with.










    share|improve this question





























      211













      211









      211


      55






      I recently set up a machine with Ubuntu Server to host game servers. I installed a backup plugin for each game server that creates frequent backups of game world files in a particular folder on the machine. I also established a cron task to automatically copy those backups to my Dropbox folder every night using rsync with the -a option.



      After a few months my Dropbox account reached its storage limit and I realized I would not be able to keep so many backups, so I configured the game server backup plugin to not retain so many backups, then waited a few days to see if it would delete the older backups as it is scheduled to do on a weekly basis. The backup plugin eventually did its job and deleted the older backups, so I was expecting the rsync cron task to subsequently delete the older backups from my Dropbox folder to match the source folder, but it has not done so. So I have a couple of questions:



      • By default, does rsync only add files to the destination folder
        that have been added to the source folder and change files that
        have been changed in the source folder but NOT delete files
        that were deleted from the source folder?


      • If that is the case, what is the best way to make rsync do this? I
        want the destination folder to perfectly reflect the source folder,
        and that means deleting any files that have been deleted from the source
        folder.


      I see some options listed in the manual page for rsync that might do the trick, but since I'm not familiar with.










      share|improve this question
















      I recently set up a machine with Ubuntu Server to host game servers. I installed a backup plugin for each game server that creates frequent backups of game world files in a particular folder on the machine. I also established a cron task to automatically copy those backups to my Dropbox folder every night using rsync with the -a option.



      After a few months my Dropbox account reached its storage limit and I realized I would not be able to keep so many backups, so I configured the game server backup plugin to not retain so many backups, then waited a few days to see if it would delete the older backups as it is scheduled to do on a weekly basis. The backup plugin eventually did its job and deleted the older backups, so I was expecting the rsync cron task to subsequently delete the older backups from my Dropbox folder to match the source folder, but it has not done so. So I have a couple of questions:



      • By default, does rsync only add files to the destination folder
        that have been added to the source folder and change files that
        have been changed in the source folder but NOT delete files
        that were deleted from the source folder?


      • If that is the case, what is the best way to make rsync do this? I
        want the destination folder to perfectly reflect the source folder,
        and that means deleting any files that have been deleted from the source
        folder.


      I see some options listed in the manual page for rsync that might do the trick, but since I'm not familiar with.







      backup sync delete rsync






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 2 '17 at 8:43









      fifi finance

      5251 gold badge6 silver badges13 bronze badges




      5251 gold badge6 silver badges13 bronze badges










      asked Jun 3 '14 at 3:53









      user254251user254251

      2,1832 gold badges8 silver badges4 bronze badges




      2,1832 gold badges8 silver badges4 bronze badges























          5 Answers
          5






          active

          oldest

          votes


















          245



















          To delete files in the target, add the --delete option to your command. For example:



          rsync -avh source/ dest/ --delete





          share|improve this answer






















          • 20





            Make sure the source is a directory. Using source/* dest/ won't work.

            – Tom Saleeba
            Sep 27 '16 at 1:13






          • 4





            I found that event with --delete or --delete-after it won't delete because of some errors: "IO error encountered -- skipping file deletion". To resolve this add --ignore-errors option and debug the errors separately

            – MHT
            Dec 18 '16 at 13:25






          • 12





            Works perfectly! Even though it is working, I would recommend to ALWAYS use -n, --dry-run option, before running rsync, specially when it comes to options like these (--delete). It will avoid any possible headache :).

            – ivanleoncz
            May 31 '17 at 16:36






          • 3





            @MHT : No answer seems to be complete without your comment.

            – Lonnie Best
            Aug 31 '18 at 21:12






          • 2





            @TheBicentennialMan -a implies -r.

            – x-yuri
            Mar 27 at 20:51



















          46



















          The rsync command wont delete any file while you use some of its options delete in that command. So if any file or folder added in source, it'll be synced to target without any deletion.



          I suggest you to use rsync for make backup from source files and use find ... rm for deletion files for period of time or size of files:



          rsync [options] SOURCE TARGET
          find TARGET -maxdepth 1 -type f -mtime +60 -exec rm -f ;


          The above code block, make a backup from source and then delete every files which last modified time are more than 2 month.



          UPDATE



          As I find that the delete options are just for TARGET that if some files are removed from source, rsync --delete remove them from TARGET. And the delete option by after and before, as mentioned in its man page:



          --delete-before receiver deletes before transfer, not during


          Means that:



          1. rsync delete the file from TARGET which are removed from SOURCE.

          2. rsync start syncing files.

          --delete-after receiver deletes after transfer, not during



          Means that:



          1. rsync start syncing files.

          2. rsync delete the file from TARGET which are removed from SOURCE after syncing.

          NOTE: the --delete-before/after implement just in TARGET.






          share|improve this answer






















          • 1





            Thanks for the reply!! Are you referring to a "delete" option for rsync? Why can't I just use the "delete" option for rsync?

            – user254251
            Jun 3 '14 at 6:03











          • @user254251, If you use delete, the rsync command immediately delete files. But in this case there is more time for any errors.

            – shgnInc
            Jun 3 '14 at 6:44











          • If I understand correctly, you're saying I should separate the deletion task from the rsync task to avoid errors. I have a question, though. The manual page for rsync lists some options that appear to serve the purpose of separating the deletion task by running it before or after the copying task. For example, I see two options called --delete-before and --delete-after. Would rsync with these options have the same effect as the method you described? I read the full description of each option on the manual page but there is some information in the descriptions that I don't understand.

            – user254251
            Jun 3 '14 at 8:02











          • @user254251, Answer was updated. I don't know if there is a way to delete files from TARGET by time limitation in rsync.

            – shgnInc
            Jun 3 '14 at 9:48












          • Thanks! So do you think I am safe from errors if I simply use the --delete-before option? I am not specifying a timeout so I shouldn't have to worry if the rsync deletion stage delays the transfer stage. rsync runs once per day and that is plenty of time to sync the backup files before the next sync, so I shouldn't need to time-limit the sync either.

            – user254251
            Jun 4 '14 at 5:13


















          6



















          This command will copy increment data and keep it in sync with remote server.



          1. It will copy only incremental data.

          2. It will delete if any data deleted from source.

          3. It will copy again from source if any data deleted at destination.

          4. basically this command will keep the both environment in sync.

          rsync -avWe ssh --delete-before (source) root@localhost:(destination)
          rsync -avW --delete-before -e ssh (source) root@localhost:(destination)



          Example:



          rsync -avWe ssh --delete-before /data root@192.168.254.254:/backup
          rsync -avW --delete-before -e ssh /data root@192.168.254.254:/backup





          share|improve this answer






















          • 2





            I think -W makes it not to copy only incremental data but to always copy whole files.

            – Tulains Córdova
            Nov 25 '15 at 19:27











          • I got this error by executing this command: rsync: Failed to exec --delete-before: No such file or directory (2)

            – Jeff Tian
            Dec 10 '15 at 2:34



















          2



















          If there are any errors during an rsync scync, rsync will not properly delete the files it should have, even if you used --delete, --delete-after, or --delete-before.



          This is why it is important to address rsync errors.



          Most of my errors were due to using the --perms option while syncing with a Non-Linux file system. When I replaced --perms with --no-perms, those errors went away and then deleting worked.



          --perms is ok when you are syncing from a Linux file system to a another Linux file system, but if you're syncing from Linux to a Non-Linux file system (like NTFS, FAT), --perms causes errors because rsync cannot set Linux permissions on a non-linux file systems. Again, errors = no delete.



          -- When syncing to a Non-Linux partition, I use --no-perms to avoid those errors that sabotage --delete, --delete-after, or --delete-before.



          If you still get errors after that, and cannot figure out how to make those errors go way, you can run a command that is exclusively dedicated to deleting the out-of-sync files:



          sudo rsync -r --delete --existing --ignore-existing --ignore-errors --progress /path/to/source/ /path/to/destination


          The command above will delete stuff that's out of sync, but won't sync any files. So, you should sync again after this. That command is based off of this answer, except that I added the --ignore-errors argument also, so it would delete even if there are errors.






          share|improve this answer






















          • 1





            Thanks for the tip! I am the original author of this question 5 years ago. I'm really glad you posted this, cuz I have been planning to set up syncing to an NTFS drive in the near future, and I probably would have run into the permissions error because I was planning to use the "-a" option for rsync, which syncs permissions (among other things). So I added "--no-perms" to my notes. I now plan to use rsync -a --no-perms --delete-before . I have a question: Wouldn't --delete-before avoid problems with file deletion by running the deletion before the sync? Thought that was its purpose.

            – user254251
            Aug 6 at 1:35












          • @user254251 - I'm not certain. I guess it would depend on how early it really "deletes before". If it some how encounters one error before the deleting begins, your screwed. My advice to you is to avoid NTFS anytime you can unless you like sharp pains in your ass :). NTFS to NTFS works fine. NTFS to Linix works fine. Avoid "Linux file system" to "Non-Linux File System"; it is too much of a pain to ensure deleting works right. You CAN accomplish this, but I decided it isn't worth the trouble versus just formatting the destination drive as EXT4.

            – Lonnie Best
            Aug 7 at 16:06



















          1



















          The ‘-delete’ flag has to appear after your /source and /destination.

          So it’s like this



          rsync -rvpthE --progress /Volumes/EOS_DIGITAL/DCIM/ /Users/mitchellg/Desktop/files -delete


          The options are:




          • -r recursive


          • -v verbose (print to screen)


          • -p permissions


          • -t time (use time instead of checksums ‘c’)


          • -h human readable


          • -E extended Info (the Color tags on a .Mac)





          share|improve this answer











          New contributor



          Mitchell Guerrero is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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/4.0/"u003ecc by-sa 4.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%2faskubuntu.com%2fquestions%2f476041%2fhow-do-i-make-rsync-delete-files-that-have-been-deleted-from-the-source-folder%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown


























            5 Answers
            5






            active

            oldest

            votes








            5 Answers
            5






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            245



















            To delete files in the target, add the --delete option to your command. For example:



            rsync -avh source/ dest/ --delete





            share|improve this answer






















            • 20





              Make sure the source is a directory. Using source/* dest/ won't work.

              – Tom Saleeba
              Sep 27 '16 at 1:13






            • 4





              I found that event with --delete or --delete-after it won't delete because of some errors: "IO error encountered -- skipping file deletion". To resolve this add --ignore-errors option and debug the errors separately

              – MHT
              Dec 18 '16 at 13:25






            • 12





              Works perfectly! Even though it is working, I would recommend to ALWAYS use -n, --dry-run option, before running rsync, specially when it comes to options like these (--delete). It will avoid any possible headache :).

              – ivanleoncz
              May 31 '17 at 16:36






            • 3





              @MHT : No answer seems to be complete without your comment.

              – Lonnie Best
              Aug 31 '18 at 21:12






            • 2





              @TheBicentennialMan -a implies -r.

              – x-yuri
              Mar 27 at 20:51
















            245



















            To delete files in the target, add the --delete option to your command. For example:



            rsync -avh source/ dest/ --delete





            share|improve this answer






















            • 20





              Make sure the source is a directory. Using source/* dest/ won't work.

              – Tom Saleeba
              Sep 27 '16 at 1:13






            • 4





              I found that event with --delete or --delete-after it won't delete because of some errors: "IO error encountered -- skipping file deletion". To resolve this add --ignore-errors option and debug the errors separately

              – MHT
              Dec 18 '16 at 13:25






            • 12





              Works perfectly! Even though it is working, I would recommend to ALWAYS use -n, --dry-run option, before running rsync, specially when it comes to options like these (--delete). It will avoid any possible headache :).

              – ivanleoncz
              May 31 '17 at 16:36






            • 3





              @MHT : No answer seems to be complete without your comment.

              – Lonnie Best
              Aug 31 '18 at 21:12






            • 2





              @TheBicentennialMan -a implies -r.

              – x-yuri
              Mar 27 at 20:51














            245















            245











            245









            To delete files in the target, add the --delete option to your command. For example:



            rsync -avh source/ dest/ --delete





            share|improve this answer
















            To delete files in the target, add the --delete option to your command. For example:



            rsync -avh source/ dest/ --delete






            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Sep 22 '17 at 9:28









            Eliah Kagan

            96.8k25 gold badges262 silver badges419 bronze badges




            96.8k25 gold badges262 silver badges419 bronze badges










            answered Aug 26 '15 at 7:14









            GarethDGarethD

            2,5611 gold badge6 silver badges2 bronze badges




            2,5611 gold badge6 silver badges2 bronze badges










            • 20





              Make sure the source is a directory. Using source/* dest/ won't work.

              – Tom Saleeba
              Sep 27 '16 at 1:13






            • 4





              I found that event with --delete or --delete-after it won't delete because of some errors: "IO error encountered -- skipping file deletion". To resolve this add --ignore-errors option and debug the errors separately

              – MHT
              Dec 18 '16 at 13:25






            • 12





              Works perfectly! Even though it is working, I would recommend to ALWAYS use -n, --dry-run option, before running rsync, specially when it comes to options like these (--delete). It will avoid any possible headache :).

              – ivanleoncz
              May 31 '17 at 16:36






            • 3





              @MHT : No answer seems to be complete without your comment.

              – Lonnie Best
              Aug 31 '18 at 21:12






            • 2





              @TheBicentennialMan -a implies -r.

              – x-yuri
              Mar 27 at 20:51













            • 20





              Make sure the source is a directory. Using source/* dest/ won't work.

              – Tom Saleeba
              Sep 27 '16 at 1:13






            • 4





              I found that event with --delete or --delete-after it won't delete because of some errors: "IO error encountered -- skipping file deletion". To resolve this add --ignore-errors option and debug the errors separately

              – MHT
              Dec 18 '16 at 13:25






            • 12





              Works perfectly! Even though it is working, I would recommend to ALWAYS use -n, --dry-run option, before running rsync, specially when it comes to options like these (--delete). It will avoid any possible headache :).

              – ivanleoncz
              May 31 '17 at 16:36






            • 3





              @MHT : No answer seems to be complete without your comment.

              – Lonnie Best
              Aug 31 '18 at 21:12






            • 2





              @TheBicentennialMan -a implies -r.

              – x-yuri
              Mar 27 at 20:51








            20




            20





            Make sure the source is a directory. Using source/* dest/ won't work.

            – Tom Saleeba
            Sep 27 '16 at 1:13





            Make sure the source is a directory. Using source/* dest/ won't work.

            – Tom Saleeba
            Sep 27 '16 at 1:13




            4




            4





            I found that event with --delete or --delete-after it won't delete because of some errors: "IO error encountered -- skipping file deletion". To resolve this add --ignore-errors option and debug the errors separately

            – MHT
            Dec 18 '16 at 13:25





            I found that event with --delete or --delete-after it won't delete because of some errors: "IO error encountered -- skipping file deletion". To resolve this add --ignore-errors option and debug the errors separately

            – MHT
            Dec 18 '16 at 13:25




            12




            12





            Works perfectly! Even though it is working, I would recommend to ALWAYS use -n, --dry-run option, before running rsync, specially when it comes to options like these (--delete). It will avoid any possible headache :).

            – ivanleoncz
            May 31 '17 at 16:36





            Works perfectly! Even though it is working, I would recommend to ALWAYS use -n, --dry-run option, before running rsync, specially when it comes to options like these (--delete). It will avoid any possible headache :).

            – ivanleoncz
            May 31 '17 at 16:36




            3




            3





            @MHT : No answer seems to be complete without your comment.

            – Lonnie Best
            Aug 31 '18 at 21:12





            @MHT : No answer seems to be complete without your comment.

            – Lonnie Best
            Aug 31 '18 at 21:12




            2




            2





            @TheBicentennialMan -a implies -r.

            – x-yuri
            Mar 27 at 20:51






            @TheBicentennialMan -a implies -r.

            – x-yuri
            Mar 27 at 20:51














            46



















            The rsync command wont delete any file while you use some of its options delete in that command. So if any file or folder added in source, it'll be synced to target without any deletion.



            I suggest you to use rsync for make backup from source files and use find ... rm for deletion files for period of time or size of files:



            rsync [options] SOURCE TARGET
            find TARGET -maxdepth 1 -type f -mtime +60 -exec rm -f ;


            The above code block, make a backup from source and then delete every files which last modified time are more than 2 month.



            UPDATE



            As I find that the delete options are just for TARGET that if some files are removed from source, rsync --delete remove them from TARGET. And the delete option by after and before, as mentioned in its man page:



            --delete-before receiver deletes before transfer, not during


            Means that:



            1. rsync delete the file from TARGET which are removed from SOURCE.

            2. rsync start syncing files.

            --delete-after receiver deletes after transfer, not during



            Means that:



            1. rsync start syncing files.

            2. rsync delete the file from TARGET which are removed from SOURCE after syncing.

            NOTE: the --delete-before/after implement just in TARGET.






            share|improve this answer






















            • 1





              Thanks for the reply!! Are you referring to a "delete" option for rsync? Why can't I just use the "delete" option for rsync?

              – user254251
              Jun 3 '14 at 6:03











            • @user254251, If you use delete, the rsync command immediately delete files. But in this case there is more time for any errors.

              – shgnInc
              Jun 3 '14 at 6:44











            • If I understand correctly, you're saying I should separate the deletion task from the rsync task to avoid errors. I have a question, though. The manual page for rsync lists some options that appear to serve the purpose of separating the deletion task by running it before or after the copying task. For example, I see two options called --delete-before and --delete-after. Would rsync with these options have the same effect as the method you described? I read the full description of each option on the manual page but there is some information in the descriptions that I don't understand.

              – user254251
              Jun 3 '14 at 8:02











            • @user254251, Answer was updated. I don't know if there is a way to delete files from TARGET by time limitation in rsync.

              – shgnInc
              Jun 3 '14 at 9:48












            • Thanks! So do you think I am safe from errors if I simply use the --delete-before option? I am not specifying a timeout so I shouldn't have to worry if the rsync deletion stage delays the transfer stage. rsync runs once per day and that is plenty of time to sync the backup files before the next sync, so I shouldn't need to time-limit the sync either.

              – user254251
              Jun 4 '14 at 5:13















            46



















            The rsync command wont delete any file while you use some of its options delete in that command. So if any file or folder added in source, it'll be synced to target without any deletion.



            I suggest you to use rsync for make backup from source files and use find ... rm for deletion files for period of time or size of files:



            rsync [options] SOURCE TARGET
            find TARGET -maxdepth 1 -type f -mtime +60 -exec rm -f ;


            The above code block, make a backup from source and then delete every files which last modified time are more than 2 month.



            UPDATE



            As I find that the delete options are just for TARGET that if some files are removed from source, rsync --delete remove them from TARGET. And the delete option by after and before, as mentioned in its man page:



            --delete-before receiver deletes before transfer, not during


            Means that:



            1. rsync delete the file from TARGET which are removed from SOURCE.

            2. rsync start syncing files.

            --delete-after receiver deletes after transfer, not during



            Means that:



            1. rsync start syncing files.

            2. rsync delete the file from TARGET which are removed from SOURCE after syncing.

            NOTE: the --delete-before/after implement just in TARGET.






            share|improve this answer






















            • 1





              Thanks for the reply!! Are you referring to a "delete" option for rsync? Why can't I just use the "delete" option for rsync?

              – user254251
              Jun 3 '14 at 6:03











            • @user254251, If you use delete, the rsync command immediately delete files. But in this case there is more time for any errors.

              – shgnInc
              Jun 3 '14 at 6:44











            • If I understand correctly, you're saying I should separate the deletion task from the rsync task to avoid errors. I have a question, though. The manual page for rsync lists some options that appear to serve the purpose of separating the deletion task by running it before or after the copying task. For example, I see two options called --delete-before and --delete-after. Would rsync with these options have the same effect as the method you described? I read the full description of each option on the manual page but there is some information in the descriptions that I don't understand.

              – user254251
              Jun 3 '14 at 8:02











            • @user254251, Answer was updated. I don't know if there is a way to delete files from TARGET by time limitation in rsync.

              – shgnInc
              Jun 3 '14 at 9:48












            • Thanks! So do you think I am safe from errors if I simply use the --delete-before option? I am not specifying a timeout so I shouldn't have to worry if the rsync deletion stage delays the transfer stage. rsync runs once per day and that is plenty of time to sync the backup files before the next sync, so I shouldn't need to time-limit the sync either.

              – user254251
              Jun 4 '14 at 5:13













            46















            46











            46









            The rsync command wont delete any file while you use some of its options delete in that command. So if any file or folder added in source, it'll be synced to target without any deletion.



            I suggest you to use rsync for make backup from source files and use find ... rm for deletion files for period of time or size of files:



            rsync [options] SOURCE TARGET
            find TARGET -maxdepth 1 -type f -mtime +60 -exec rm -f ;


            The above code block, make a backup from source and then delete every files which last modified time are more than 2 month.



            UPDATE



            As I find that the delete options are just for TARGET that if some files are removed from source, rsync --delete remove them from TARGET. And the delete option by after and before, as mentioned in its man page:



            --delete-before receiver deletes before transfer, not during


            Means that:



            1. rsync delete the file from TARGET which are removed from SOURCE.

            2. rsync start syncing files.

            --delete-after receiver deletes after transfer, not during



            Means that:



            1. rsync start syncing files.

            2. rsync delete the file from TARGET which are removed from SOURCE after syncing.

            NOTE: the --delete-before/after implement just in TARGET.






            share|improve this answer
















            The rsync command wont delete any file while you use some of its options delete in that command. So if any file or folder added in source, it'll be synced to target without any deletion.



            I suggest you to use rsync for make backup from source files and use find ... rm for deletion files for period of time or size of files:



            rsync [options] SOURCE TARGET
            find TARGET -maxdepth 1 -type f -mtime +60 -exec rm -f ;


            The above code block, make a backup from source and then delete every files which last modified time are more than 2 month.



            UPDATE



            As I find that the delete options are just for TARGET that if some files are removed from source, rsync --delete remove them from TARGET. And the delete option by after and before, as mentioned in its man page:



            --delete-before receiver deletes before transfer, not during


            Means that:



            1. rsync delete the file from TARGET which are removed from SOURCE.

            2. rsync start syncing files.

            --delete-after receiver deletes after transfer, not during



            Means that:



            1. rsync start syncing files.

            2. rsync delete the file from TARGET which are removed from SOURCE after syncing.

            NOTE: the --delete-before/after implement just in TARGET.







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Jun 3 '17 at 14:50









            ucsky

            4071 gold badge6 silver badges18 bronze badges




            4071 gold badge6 silver badges18 bronze badges










            answered Jun 3 '14 at 4:13









            shgnIncshgnInc

            1,7353 gold badges20 silver badges28 bronze badges




            1,7353 gold badges20 silver badges28 bronze badges










            • 1





              Thanks for the reply!! Are you referring to a "delete" option for rsync? Why can't I just use the "delete" option for rsync?

              – user254251
              Jun 3 '14 at 6:03











            • @user254251, If you use delete, the rsync command immediately delete files. But in this case there is more time for any errors.

              – shgnInc
              Jun 3 '14 at 6:44











            • If I understand correctly, you're saying I should separate the deletion task from the rsync task to avoid errors. I have a question, though. The manual page for rsync lists some options that appear to serve the purpose of separating the deletion task by running it before or after the copying task. For example, I see two options called --delete-before and --delete-after. Would rsync with these options have the same effect as the method you described? I read the full description of each option on the manual page but there is some information in the descriptions that I don't understand.

              – user254251
              Jun 3 '14 at 8:02











            • @user254251, Answer was updated. I don't know if there is a way to delete files from TARGET by time limitation in rsync.

              – shgnInc
              Jun 3 '14 at 9:48












            • Thanks! So do you think I am safe from errors if I simply use the --delete-before option? I am not specifying a timeout so I shouldn't have to worry if the rsync deletion stage delays the transfer stage. rsync runs once per day and that is plenty of time to sync the backup files before the next sync, so I shouldn't need to time-limit the sync either.

              – user254251
              Jun 4 '14 at 5:13












            • 1





              Thanks for the reply!! Are you referring to a "delete" option for rsync? Why can't I just use the "delete" option for rsync?

              – user254251
              Jun 3 '14 at 6:03











            • @user254251, If you use delete, the rsync command immediately delete files. But in this case there is more time for any errors.

              – shgnInc
              Jun 3 '14 at 6:44











            • If I understand correctly, you're saying I should separate the deletion task from the rsync task to avoid errors. I have a question, though. The manual page for rsync lists some options that appear to serve the purpose of separating the deletion task by running it before or after the copying task. For example, I see two options called --delete-before and --delete-after. Would rsync with these options have the same effect as the method you described? I read the full description of each option on the manual page but there is some information in the descriptions that I don't understand.

              – user254251
              Jun 3 '14 at 8:02











            • @user254251, Answer was updated. I don't know if there is a way to delete files from TARGET by time limitation in rsync.

              – shgnInc
              Jun 3 '14 at 9:48












            • Thanks! So do you think I am safe from errors if I simply use the --delete-before option? I am not specifying a timeout so I shouldn't have to worry if the rsync deletion stage delays the transfer stage. rsync runs once per day and that is plenty of time to sync the backup files before the next sync, so I shouldn't need to time-limit the sync either.

              – user254251
              Jun 4 '14 at 5:13







            1




            1





            Thanks for the reply!! Are you referring to a "delete" option for rsync? Why can't I just use the "delete" option for rsync?

            – user254251
            Jun 3 '14 at 6:03





            Thanks for the reply!! Are you referring to a "delete" option for rsync? Why can't I just use the "delete" option for rsync?

            – user254251
            Jun 3 '14 at 6:03













            @user254251, If you use delete, the rsync command immediately delete files. But in this case there is more time for any errors.

            – shgnInc
            Jun 3 '14 at 6:44





            @user254251, If you use delete, the rsync command immediately delete files. But in this case there is more time for any errors.

            – shgnInc
            Jun 3 '14 at 6:44













            If I understand correctly, you're saying I should separate the deletion task from the rsync task to avoid errors. I have a question, though. The manual page for rsync lists some options that appear to serve the purpose of separating the deletion task by running it before or after the copying task. For example, I see two options called --delete-before and --delete-after. Would rsync with these options have the same effect as the method you described? I read the full description of each option on the manual page but there is some information in the descriptions that I don't understand.

            – user254251
            Jun 3 '14 at 8:02





            If I understand correctly, you're saying I should separate the deletion task from the rsync task to avoid errors. I have a question, though. The manual page for rsync lists some options that appear to serve the purpose of separating the deletion task by running it before or after the copying task. For example, I see two options called --delete-before and --delete-after. Would rsync with these options have the same effect as the method you described? I read the full description of each option on the manual page but there is some information in the descriptions that I don't understand.

            – user254251
            Jun 3 '14 at 8:02













            @user254251, Answer was updated. I don't know if there is a way to delete files from TARGET by time limitation in rsync.

            – shgnInc
            Jun 3 '14 at 9:48






            @user254251, Answer was updated. I don't know if there is a way to delete files from TARGET by time limitation in rsync.

            – shgnInc
            Jun 3 '14 at 9:48














            Thanks! So do you think I am safe from errors if I simply use the --delete-before option? I am not specifying a timeout so I shouldn't have to worry if the rsync deletion stage delays the transfer stage. rsync runs once per day and that is plenty of time to sync the backup files before the next sync, so I shouldn't need to time-limit the sync either.

            – user254251
            Jun 4 '14 at 5:13





            Thanks! So do you think I am safe from errors if I simply use the --delete-before option? I am not specifying a timeout so I shouldn't have to worry if the rsync deletion stage delays the transfer stage. rsync runs once per day and that is plenty of time to sync the backup files before the next sync, so I shouldn't need to time-limit the sync either.

            – user254251
            Jun 4 '14 at 5:13











            6



















            This command will copy increment data and keep it in sync with remote server.



            1. It will copy only incremental data.

            2. It will delete if any data deleted from source.

            3. It will copy again from source if any data deleted at destination.

            4. basically this command will keep the both environment in sync.

            rsync -avWe ssh --delete-before (source) root@localhost:(destination)
            rsync -avW --delete-before -e ssh (source) root@localhost:(destination)



            Example:



            rsync -avWe ssh --delete-before /data root@192.168.254.254:/backup
            rsync -avW --delete-before -e ssh /data root@192.168.254.254:/backup





            share|improve this answer






















            • 2





              I think -W makes it not to copy only incremental data but to always copy whole files.

              – Tulains Córdova
              Nov 25 '15 at 19:27











            • I got this error by executing this command: rsync: Failed to exec --delete-before: No such file or directory (2)

              – Jeff Tian
              Dec 10 '15 at 2:34
















            6



















            This command will copy increment data and keep it in sync with remote server.



            1. It will copy only incremental data.

            2. It will delete if any data deleted from source.

            3. It will copy again from source if any data deleted at destination.

            4. basically this command will keep the both environment in sync.

            rsync -avWe ssh --delete-before (source) root@localhost:(destination)
            rsync -avW --delete-before -e ssh (source) root@localhost:(destination)



            Example:



            rsync -avWe ssh --delete-before /data root@192.168.254.254:/backup
            rsync -avW --delete-before -e ssh /data root@192.168.254.254:/backup





            share|improve this answer






















            • 2





              I think -W makes it not to copy only incremental data but to always copy whole files.

              – Tulains Córdova
              Nov 25 '15 at 19:27











            • I got this error by executing this command: rsync: Failed to exec --delete-before: No such file or directory (2)

              – Jeff Tian
              Dec 10 '15 at 2:34














            6















            6











            6









            This command will copy increment data and keep it in sync with remote server.



            1. It will copy only incremental data.

            2. It will delete if any data deleted from source.

            3. It will copy again from source if any data deleted at destination.

            4. basically this command will keep the both environment in sync.

            rsync -avWe ssh --delete-before (source) root@localhost:(destination)
            rsync -avW --delete-before -e ssh (source) root@localhost:(destination)



            Example:



            rsync -avWe ssh --delete-before /data root@192.168.254.254:/backup
            rsync -avW --delete-before -e ssh /data root@192.168.254.254:/backup





            share|improve this answer
















            This command will copy increment data and keep it in sync with remote server.



            1. It will copy only incremental data.

            2. It will delete if any data deleted from source.

            3. It will copy again from source if any data deleted at destination.

            4. basically this command will keep the both environment in sync.

            rsync -avWe ssh --delete-before (source) root@localhost:(destination)
            rsync -avW --delete-before -e ssh (source) root@localhost:(destination)



            Example:



            rsync -avWe ssh --delete-before /data root@192.168.254.254:/backup
            rsync -avW --delete-before -e ssh /data root@192.168.254.254:/backup






            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited May 29 '16 at 21:24









            Community

            1




            1










            answered Jul 29 '15 at 12:12









            Ganesh GhubeGanesh Ghube

            691 silver badge1 bronze badge




            691 silver badge1 bronze badge










            • 2





              I think -W makes it not to copy only incremental data but to always copy whole files.

              – Tulains Córdova
              Nov 25 '15 at 19:27











            • I got this error by executing this command: rsync: Failed to exec --delete-before: No such file or directory (2)

              – Jeff Tian
              Dec 10 '15 at 2:34













            • 2





              I think -W makes it not to copy only incremental data but to always copy whole files.

              – Tulains Córdova
              Nov 25 '15 at 19:27











            • I got this error by executing this command: rsync: Failed to exec --delete-before: No such file or directory (2)

              – Jeff Tian
              Dec 10 '15 at 2:34








            2




            2





            I think -W makes it not to copy only incremental data but to always copy whole files.

            – Tulains Córdova
            Nov 25 '15 at 19:27





            I think -W makes it not to copy only incremental data but to always copy whole files.

            – Tulains Córdova
            Nov 25 '15 at 19:27













            I got this error by executing this command: rsync: Failed to exec --delete-before: No such file or directory (2)

            – Jeff Tian
            Dec 10 '15 at 2:34






            I got this error by executing this command: rsync: Failed to exec --delete-before: No such file or directory (2)

            – Jeff Tian
            Dec 10 '15 at 2:34












            2



















            If there are any errors during an rsync scync, rsync will not properly delete the files it should have, even if you used --delete, --delete-after, or --delete-before.



            This is why it is important to address rsync errors.



            Most of my errors were due to using the --perms option while syncing with a Non-Linux file system. When I replaced --perms with --no-perms, those errors went away and then deleting worked.



            --perms is ok when you are syncing from a Linux file system to a another Linux file system, but if you're syncing from Linux to a Non-Linux file system (like NTFS, FAT), --perms causes errors because rsync cannot set Linux permissions on a non-linux file systems. Again, errors = no delete.



            -- When syncing to a Non-Linux partition, I use --no-perms to avoid those errors that sabotage --delete, --delete-after, or --delete-before.



            If you still get errors after that, and cannot figure out how to make those errors go way, you can run a command that is exclusively dedicated to deleting the out-of-sync files:



            sudo rsync -r --delete --existing --ignore-existing --ignore-errors --progress /path/to/source/ /path/to/destination


            The command above will delete stuff that's out of sync, but won't sync any files. So, you should sync again after this. That command is based off of this answer, except that I added the --ignore-errors argument also, so it would delete even if there are errors.






            share|improve this answer






















            • 1





              Thanks for the tip! I am the original author of this question 5 years ago. I'm really glad you posted this, cuz I have been planning to set up syncing to an NTFS drive in the near future, and I probably would have run into the permissions error because I was planning to use the "-a" option for rsync, which syncs permissions (among other things). So I added "--no-perms" to my notes. I now plan to use rsync -a --no-perms --delete-before . I have a question: Wouldn't --delete-before avoid problems with file deletion by running the deletion before the sync? Thought that was its purpose.

              – user254251
              Aug 6 at 1:35












            • @user254251 - I'm not certain. I guess it would depend on how early it really "deletes before". If it some how encounters one error before the deleting begins, your screwed. My advice to you is to avoid NTFS anytime you can unless you like sharp pains in your ass :). NTFS to NTFS works fine. NTFS to Linix works fine. Avoid "Linux file system" to "Non-Linux File System"; it is too much of a pain to ensure deleting works right. You CAN accomplish this, but I decided it isn't worth the trouble versus just formatting the destination drive as EXT4.

              – Lonnie Best
              Aug 7 at 16:06
















            2



















            If there are any errors during an rsync scync, rsync will not properly delete the files it should have, even if you used --delete, --delete-after, or --delete-before.



            This is why it is important to address rsync errors.



            Most of my errors were due to using the --perms option while syncing with a Non-Linux file system. When I replaced --perms with --no-perms, those errors went away and then deleting worked.



            --perms is ok when you are syncing from a Linux file system to a another Linux file system, but if you're syncing from Linux to a Non-Linux file system (like NTFS, FAT), --perms causes errors because rsync cannot set Linux permissions on a non-linux file systems. Again, errors = no delete.



            -- When syncing to a Non-Linux partition, I use --no-perms to avoid those errors that sabotage --delete, --delete-after, or --delete-before.



            If you still get errors after that, and cannot figure out how to make those errors go way, you can run a command that is exclusively dedicated to deleting the out-of-sync files:



            sudo rsync -r --delete --existing --ignore-existing --ignore-errors --progress /path/to/source/ /path/to/destination


            The command above will delete stuff that's out of sync, but won't sync any files. So, you should sync again after this. That command is based off of this answer, except that I added the --ignore-errors argument also, so it would delete even if there are errors.






            share|improve this answer






















            • 1





              Thanks for the tip! I am the original author of this question 5 years ago. I'm really glad you posted this, cuz I have been planning to set up syncing to an NTFS drive in the near future, and I probably would have run into the permissions error because I was planning to use the "-a" option for rsync, which syncs permissions (among other things). So I added "--no-perms" to my notes. I now plan to use rsync -a --no-perms --delete-before . I have a question: Wouldn't --delete-before avoid problems with file deletion by running the deletion before the sync? Thought that was its purpose.

              – user254251
              Aug 6 at 1:35












            • @user254251 - I'm not certain. I guess it would depend on how early it really "deletes before". If it some how encounters one error before the deleting begins, your screwed. My advice to you is to avoid NTFS anytime you can unless you like sharp pains in your ass :). NTFS to NTFS works fine. NTFS to Linix works fine. Avoid "Linux file system" to "Non-Linux File System"; it is too much of a pain to ensure deleting works right. You CAN accomplish this, but I decided it isn't worth the trouble versus just formatting the destination drive as EXT4.

              – Lonnie Best
              Aug 7 at 16:06














            2















            2











            2









            If there are any errors during an rsync scync, rsync will not properly delete the files it should have, even if you used --delete, --delete-after, or --delete-before.



            This is why it is important to address rsync errors.



            Most of my errors were due to using the --perms option while syncing with a Non-Linux file system. When I replaced --perms with --no-perms, those errors went away and then deleting worked.



            --perms is ok when you are syncing from a Linux file system to a another Linux file system, but if you're syncing from Linux to a Non-Linux file system (like NTFS, FAT), --perms causes errors because rsync cannot set Linux permissions on a non-linux file systems. Again, errors = no delete.



            -- When syncing to a Non-Linux partition, I use --no-perms to avoid those errors that sabotage --delete, --delete-after, or --delete-before.



            If you still get errors after that, and cannot figure out how to make those errors go way, you can run a command that is exclusively dedicated to deleting the out-of-sync files:



            sudo rsync -r --delete --existing --ignore-existing --ignore-errors --progress /path/to/source/ /path/to/destination


            The command above will delete stuff that's out of sync, but won't sync any files. So, you should sync again after this. That command is based off of this answer, except that I added the --ignore-errors argument also, so it would delete even if there are errors.






            share|improve this answer
















            If there are any errors during an rsync scync, rsync will not properly delete the files it should have, even if you used --delete, --delete-after, or --delete-before.



            This is why it is important to address rsync errors.



            Most of my errors were due to using the --perms option while syncing with a Non-Linux file system. When I replaced --perms with --no-perms, those errors went away and then deleting worked.



            --perms is ok when you are syncing from a Linux file system to a another Linux file system, but if you're syncing from Linux to a Non-Linux file system (like NTFS, FAT), --perms causes errors because rsync cannot set Linux permissions on a non-linux file systems. Again, errors = no delete.



            -- When syncing to a Non-Linux partition, I use --no-perms to avoid those errors that sabotage --delete, --delete-after, or --delete-before.



            If you still get errors after that, and cannot figure out how to make those errors go way, you can run a command that is exclusively dedicated to deleting the out-of-sync files:



            sudo rsync -r --delete --existing --ignore-existing --ignore-errors --progress /path/to/source/ /path/to/destination


            The command above will delete stuff that's out of sync, but won't sync any files. So, you should sync again after this. That command is based off of this answer, except that I added the --ignore-errors argument also, so it would delete even if there are errors.







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Sep 30 at 22:08

























            answered Jul 26 at 18:57









            Lonnie BestLonnie Best

            1,2652 gold badges15 silver badges31 bronze badges




            1,2652 gold badges15 silver badges31 bronze badges










            • 1





              Thanks for the tip! I am the original author of this question 5 years ago. I'm really glad you posted this, cuz I have been planning to set up syncing to an NTFS drive in the near future, and I probably would have run into the permissions error because I was planning to use the "-a" option for rsync, which syncs permissions (among other things). So I added "--no-perms" to my notes. I now plan to use rsync -a --no-perms --delete-before . I have a question: Wouldn't --delete-before avoid problems with file deletion by running the deletion before the sync? Thought that was its purpose.

              – user254251
              Aug 6 at 1:35












            • @user254251 - I'm not certain. I guess it would depend on how early it really "deletes before". If it some how encounters one error before the deleting begins, your screwed. My advice to you is to avoid NTFS anytime you can unless you like sharp pains in your ass :). NTFS to NTFS works fine. NTFS to Linix works fine. Avoid "Linux file system" to "Non-Linux File System"; it is too much of a pain to ensure deleting works right. You CAN accomplish this, but I decided it isn't worth the trouble versus just formatting the destination drive as EXT4.

              – Lonnie Best
              Aug 7 at 16:06













            • 1





              Thanks for the tip! I am the original author of this question 5 years ago. I'm really glad you posted this, cuz I have been planning to set up syncing to an NTFS drive in the near future, and I probably would have run into the permissions error because I was planning to use the "-a" option for rsync, which syncs permissions (among other things). So I added "--no-perms" to my notes. I now plan to use rsync -a --no-perms --delete-before . I have a question: Wouldn't --delete-before avoid problems with file deletion by running the deletion before the sync? Thought that was its purpose.

              – user254251
              Aug 6 at 1:35












            • @user254251 - I'm not certain. I guess it would depend on how early it really "deletes before". If it some how encounters one error before the deleting begins, your screwed. My advice to you is to avoid NTFS anytime you can unless you like sharp pains in your ass :). NTFS to NTFS works fine. NTFS to Linix works fine. Avoid "Linux file system" to "Non-Linux File System"; it is too much of a pain to ensure deleting works right. You CAN accomplish this, but I decided it isn't worth the trouble versus just formatting the destination drive as EXT4.

              – Lonnie Best
              Aug 7 at 16:06








            1




            1





            Thanks for the tip! I am the original author of this question 5 years ago. I'm really glad you posted this, cuz I have been planning to set up syncing to an NTFS drive in the near future, and I probably would have run into the permissions error because I was planning to use the "-a" option for rsync, which syncs permissions (among other things). So I added "--no-perms" to my notes. I now plan to use rsync -a --no-perms --delete-before . I have a question: Wouldn't --delete-before avoid problems with file deletion by running the deletion before the sync? Thought that was its purpose.

            – user254251
            Aug 6 at 1:35






            Thanks for the tip! I am the original author of this question 5 years ago. I'm really glad you posted this, cuz I have been planning to set up syncing to an NTFS drive in the near future, and I probably would have run into the permissions error because I was planning to use the "-a" option for rsync, which syncs permissions (among other things). So I added "--no-perms" to my notes. I now plan to use rsync -a --no-perms --delete-before . I have a question: Wouldn't --delete-before avoid problems with file deletion by running the deletion before the sync? Thought that was its purpose.

            – user254251
            Aug 6 at 1:35














            @user254251 - I'm not certain. I guess it would depend on how early it really "deletes before". If it some how encounters one error before the deleting begins, your screwed. My advice to you is to avoid NTFS anytime you can unless you like sharp pains in your ass :). NTFS to NTFS works fine. NTFS to Linix works fine. Avoid "Linux file system" to "Non-Linux File System"; it is too much of a pain to ensure deleting works right. You CAN accomplish this, but I decided it isn't worth the trouble versus just formatting the destination drive as EXT4.

            – Lonnie Best
            Aug 7 at 16:06






            @user254251 - I'm not certain. I guess it would depend on how early it really "deletes before". If it some how encounters one error before the deleting begins, your screwed. My advice to you is to avoid NTFS anytime you can unless you like sharp pains in your ass :). NTFS to NTFS works fine. NTFS to Linix works fine. Avoid "Linux file system" to "Non-Linux File System"; it is too much of a pain to ensure deleting works right. You CAN accomplish this, but I decided it isn't worth the trouble versus just formatting the destination drive as EXT4.

            – Lonnie Best
            Aug 7 at 16:06












            1



















            The ‘-delete’ flag has to appear after your /source and /destination.

            So it’s like this



            rsync -rvpthE --progress /Volumes/EOS_DIGITAL/DCIM/ /Users/mitchellg/Desktop/files -delete


            The options are:




            • -r recursive


            • -v verbose (print to screen)


            • -p permissions


            • -t time (use time instead of checksums ‘c’)


            • -h human readable


            • -E extended Info (the Color tags on a .Mac)





            share|improve this answer











            New contributor



            Mitchell Guerrero is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.
























              1



















              The ‘-delete’ flag has to appear after your /source and /destination.

              So it’s like this



              rsync -rvpthE --progress /Volumes/EOS_DIGITAL/DCIM/ /Users/mitchellg/Desktop/files -delete


              The options are:




              • -r recursive


              • -v verbose (print to screen)


              • -p permissions


              • -t time (use time instead of checksums ‘c’)


              • -h human readable


              • -E extended Info (the Color tags on a .Mac)





              share|improve this answer











              New contributor



              Mitchell Guerrero is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






















                1















                1











                1









                The ‘-delete’ flag has to appear after your /source and /destination.

                So it’s like this



                rsync -rvpthE --progress /Volumes/EOS_DIGITAL/DCIM/ /Users/mitchellg/Desktop/files -delete


                The options are:




                • -r recursive


                • -v verbose (print to screen)


                • -p permissions


                • -t time (use time instead of checksums ‘c’)


                • -h human readable


                • -E extended Info (the Color tags on a .Mac)





                share|improve this answer











                New contributor



                Mitchell Guerrero is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                The ‘-delete’ flag has to appear after your /source and /destination.

                So it’s like this



                rsync -rvpthE --progress /Volumes/EOS_DIGITAL/DCIM/ /Users/mitchellg/Desktop/files -delete


                The options are:




                • -r recursive


                • -v verbose (print to screen)


                • -p permissions


                • -t time (use time instead of checksums ‘c’)


                • -h human readable


                • -E extended Info (the Color tags on a .Mac)






                share|improve this answer











                New contributor



                Mitchell Guerrero is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                share|improve this answer




                share|improve this answer








                edited 2 days ago









                zx485

                1,7385 gold badges15 silver badges18 bronze badges




                1,7385 gold badges15 silver badges18 bronze badges






                New contributor



                Mitchell Guerrero is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                answered Dec 10 at 19:50









                Mitchell GuerreroMitchell Guerrero

                111 bronze badge




                111 bronze badge




                New contributor



                Mitchell Guerrero is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




                New contributor




                Mitchell Guerrero is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.

































                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • 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%2faskubuntu.com%2fquestions%2f476041%2fhow-do-i-make-rsync-delete-files-that-have-been-deleted-from-the-source-folder%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

                    Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

                    How to get a smooth, uniform ParametricPlot of a 2D Region?How to plot a complicated Region?How to exclude a region from ParametricPlotHow discretize a region placing vertices on a specific non-uniform gridHow to transform a Plot or a ParametricPlot into a RegionHow can I get a smooth plot of a bounded region?Smooth ParametricPlot3D with RegionFunction?Smooth border of a region ParametricPlotSmooth region boundarySmooth region plot from list of pointsGet minimum y of a certain x in a region

                    Genealogie vun de Merowenger Vum Merowech bis zum Chilperich I. | Navigatiounsmenü