Rsync backup script

Discussion in 'Mac Programming' started by jrock2004, Jan 19, 2012.

  1. macrumors 6502

    Joined:
    May 4, 2008
    Location:
    PA
    #1
    I am working on an rsync backup script and I cannot get includes and excludes to work properly. I basically want to exclude everything except some things I want to backup. I created an include.txt file and it I started with just one file.

    Code:
    /Users/johnc/test.txt
    
    I am trying to run the command outside of the script to get it to work first, but here it is

    Code:
    rsync -av --include-from 'include.txt' --exclude '*' / /Volumes/Backup
    
    Any thoughts on what I am doing wrong here? Thanks
     
  2. macrumors 603

    Joined:
    Aug 9, 2009
    #2
    A file containing a list of the exact files to sync sounds exactly like the --files-from=FILE option.
    To me, that suggests any use of --include-from or --exclude would be wrong, and could cause a malfunction, such as things being excluded or included that aren't in the file-list.

    Furthermore, --include-from is not for a list of files to include, but patterns to include. A pattern is not the same as a filename.

    Finally, without trying it, your pattern options don't follow the way options are shown in the man page.
    The man page shows --exclude=PATTERN, which is not the same as --exclude PATTERN.
    Equals-sign is not space.


    I gathered the above simply by a quick browse of rsync's man page, looking specifically at the options you show.

    Did you come up with your command-line by following an example found on the web, or some other source? If so, what is the URL?
     
  3. thread starter macrumors 6502

    Joined:
    May 4, 2008
    Location:
    PA
    #3
    Ok so I looked closer in the man pages and I have found

    Code:
    rsync -av --files-from='includes.txt' / /Volumes/Backup/
    
    That works.
     

Share This Page