rsync exclude from file

Discussion in 'macOS' started by junglepunk, Dec 28, 2010.

  1. junglepunk macrumors newbie

    Joined:
    Sep 30, 2009
    #1
    I am successfully using rsync to backup my mac, however upon backing up my documents folder I found that I just had to many things I needed to exclude so I wanted to switch from regular --exclude to --exclude-from=file.txt

    My problem is that when I try to exclude from a file I get a "No such file or directory" error and I don't understand why. Here's an actual output:

    Code:
    My-MacBook-Pro:~ username$ rsync -arvn --del --exclude-from='/Volumes/Mac\ Data/Users/username/Documents/exclude_doc.txt'  ~/Documents/ root@192.168.0.150:/volume1/documents/
    rsync: failed to open exclude file /Volumes/Mac\ Data/Users/gustavlothe/Documents/exclude_doc.txt: No such file or directory (2)
    rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-40/rsync/exclude.c(1005) [client=2.6.9]
    
    I also get that same error if I use the ~ to specify my home folder. There is no difference.

    Please help.
     
  2. Dalton63841 macrumors 65816

    Dalton63841

    Joined:
    Nov 27, 2010
    Location:
    SEMO, USA
    #2
    Did you create file.txt and make a list of what to exclude?
     
  3. Hal Itosis macrumors 6502a

    Hal Itosis

    Joined:
    Feb 20, 2010
    #3
    More than likely, it's the combination of quotes and escapes.

    Try this (no escape between Mac and Data):
    --exclude-from='/Volumes/Mac Data/Users/username/Documents/exclude_doc.txt'


    or this (no single quotes around the path):
    --exclude-from=/Volumes/Mac\ Data/Users/username/Documents/exclude_doc.txt


    Both (either) should work.
     
  4. junglepunk thread starter macrumors newbie

    Joined:
    Sep 30, 2009
    #4
    Holy crap. It was because of the escape. I would never have suspected that. Thank you.
     
  5. Hal Itosis macrumors 6502a

    Hal Itosis

    Joined:
    Feb 20, 2010
    #5
    Not specifically the escape's fault... it was the *combination* that caused it.

    [try the version without quotes... it should also work]
     
  6. junglepunk thread starter macrumors newbie

    Joined:
    Sep 30, 2009
    #6
    Nope. Doesn't work without quotes but with escape. Also does not work without quotes and without escape. Is that weird?

    But most annoyingly, the exclude file is in my Documents folder, which is in my home dir, yet ~ does not work. Why is that?
     
  7. Hal Itosis macrumors 6502a

    Hal Itosis

    Joined:
    Feb 20, 2010
    #7
    Unexpected. (maybe doubling\\ the escape would do it)


    As expected.


    Because of the quotes...

    $ ls "~"
    ls: ~: No such file or directory
    $ ls '~'
    ls: ~: No such file or directory


    How long is your exclude list? [post it.]
    I know a way to do it right within the script itself.
     

Share This Page