Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    rsync with --delete but do not delete peer dirs on target


    rsync with --delete won't honor the delete if the source is something/*. I want the delete to work, but not to delete directories on the target that are peer to the intended directory. For example, using these source and target file structures:

    Source on desktop:
    Code:
    ~/
        Money/
            some_files
        Friends/
            more_files
    Target on laptop:
    Code:
    ~/
        Money/
            some_files
        Friends/
            other_files
    The goal is for rsync, with the --delete option, to sync ~/Money/some_files between the desktop and the laptop, BUT

    I do not want rsync to delete or even update ~/Money/Friends/ or ~/Money/Friends/other_files on the laptop.

    I have not found the magic invocation yet. Any help? I can offer a cold homebrew for a good solution!

  2. #2

    Solved

    Quote Originally Posted by JavaMeister View Post
    rsync with --delete won't honor the delete if the source is something/*. I want the delete to work, but not to delete directories on the target that are peer to the intended directory. For example, using these source and target file structures:

    Source on desktop:
    Code:
    ~/
        Money/
            some_files
        Friends/
            more_files
    Target on laptop:
    Code:
    ~/
        Money/
            some_files
        Friends/
            other_files
    The goal is for rsync, with the --delete option, to sync ~/Money/some_files between the desktop and the laptop, BUT

    I do not want rsync to delete or even update ~/Money/Friends/ or ~/Money/Friends/other_files on the laptop.

    I have not found the magic invocation yet. Any help? I can offer a cold homebrew for a good solution!
    The solution is to use the --exclude=Friends option.

    There was an error in the next-to-last line above, which should have read:
    "I do not want rsync to delete or even update ~/Friends/ or ~/Friends/other_files on the laptop."

    Also note the distinction between Money and Money/.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •