The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Help with rsync exclude list

stiliststilist Registered User regular
edited July 2008 in Help / Advice Forum
I recently put together a little Bash script to automatically back up one of my hard disks. It works pretty well, except that I always get errors in the console because it tries to copy some of OS X’s internal folders (fsevents and Spotlight).

The obvious solution is to take advantage of rsync’s exclude functionality. Unfortunately, I’m stupid and can’t figure out what I’m doing wrong.
Pangu:~ stilist$ cat ./backupmusic.bash
#!/bin/sh
RSYNC="rsync --size-only --delete -vax --modify-window=1 --exclude-from '/Users/stilist/.rsync/exclude.txt'"

SOURCE=/Volumes/Leviathan
TARGET=/Volumes/MUSICBKP
$RSYNC $SOURCE $TARGET
Pangu:~ stilist$ cat .rsync/exclude.txt
.DS_Store
.fseventsd/
.Spotlight-V100/
Pangu:~ stilist$ ./backupmusic.bash
rsync: failed to open exclude file '/Users/stilist/.rsync/exclude.txt': No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-31/rsync/exclude.c(343)
Pangu:~ stilist$ ls -l ./backupmusic.bash
-rwxr-xr-x@ 1 stilist wheel 194 Jul 23 13:53 ./backupmusic.bash
Pangu:~ stilist$ ls -l .rsync/exclude.txt
-rwxr-xr-x@ 1 stilist wheel 39 Jul 23 14:01 .rsync/exclude.txt

The file clearly exists and I gave it execution permission. What the heck am I missing?

I poop things on my site and twitter
stilist on

Posts

  • vonPoonBurGervonPoonBurGer Registered User regular
    edited July 2008
    I think what's happening is that the single quotes in your command are getting interpreted literally. You have no file named '/Users/stilist/.rsync/exclude.txt', but you do have a file named /Users/stilist/.rsync/exclude.txt. Remember, unlike Windows file naming conventions, *NIX shells will allow you to create files with all manner of bizarre special characters in them. Instead of using single quotes, I think your rsync command ought to look like this:
    rsync --size-only --delete -vax --modify-window=1 --exclude-from=/Users/stilist/.rsync/exclude.txt
    

    vonPoonBurGer on
    Xbox Live:vonPoon | PSN: vonPoon | Steam: vonPoonBurGer
  • stiliststilist Registered User regular
    edited July 2008
    I think what's happening is that the single quotes in your command are getting interpreted literally. You have no file named '/Users/stilist/.rsync/exclude.txt', but you do have a file named /Users/stilist/.rsync/exclude.txt. Remember, unlike Windows file naming conventions, *NIX shells will allow you to create files with all manner of bizarre special characters in them. Instead of using single quotes, I think your rsync command ought to look like this:
    rsync --size-only --delete -vax --modify-window=1 --exclude-from=/Users/stilist/.rsync/exclude.txt
    
    Huh, that seems to have done it. I had something similar before, but I probably had a relative path.

    Thanks!

    stilist on
    I poop things on my site and twitter
Sign In or Register to comment.