Haha, thanks for the reply.
I am backing up a Macbook which uses bash, so everything is good. The /Library folder houses settings and data for programs. I want this backed up in the event my laptop dies and I need a chat log or my bookmarks, for example, or if I want to restore application layouts/preferences. I'm using rsyncx (I think it's just rsync with HFS+ support).
The script was actually hard-coded, but I run SSH on a different port so I wanted to hide my preferences with shell variables that could be understood. I actually changed this in my script after posting, and the '...''$DEST_PORT'' was the remedy to an error I was getting (thinking it was the literal of $DEST_PORT). I'll keep in mind the different quotes for the future.
On to my problem... I've tried to find several man pages on rsync and the information they provide hasn't provided a wide enough range of examples to help me with my problem.
To figure out what's wrong, here's some selections, courtesy of
http://www.samba.org/ftp/rsync/rsync.html.
Quote:
If the pattern starts with a / then it is anchored to a particular spot in the hierarchy of files, otherwise it is matched against the end of the pathname. This is similar to a leading ^ in regular expressions.
|
/Library is Library in the transfer's root. This appears correct.
Quote:
If the pattern ends with a / then it will only match a directory, not a regular file, symlink, or device.
|
I hope to include the directory /Library/Application Support/Camino/ for example. I want to exclude everything in the directory /Library/ but the ones I included. This may be the problem, but let's continue.
Quote:
Note that, when using the --recursive (-r) option (which is implied by -a), every subcomponent of every path is visited from the top down, so include/exclude patterns get applied recursively to each subcomponent's full name (e.g. to include "/foo/bar/baz" the subcomponents "/foo" and "/foo/bar" must not be excluded).
|
This may be the problem. In fact, this sounds like the problem to me. However, I want to avoid excluding all the other directories that aren't included, as that list of directories may change.
Let's look at wildcards...
Quote:
a '*' matches any non-empty path component (it stops at slashes).
use '**' to match anything, including slashes.
a '?' matches any character except a slash (/).
|
Including a wildcard with my exclude (ie /Library/** to exclude everything) must be excluding the folders I want to include as well as those files/folders that I do not since this does not remedy my situation.
Quote:
The combination of "+ foo/", "+ foo/bar.c", and "- *" would include only the foo directory and foo/bar.c (the foo directory must be explicitly included or it would be excluded by the "*")
|
What this says to me is I should be able to go
Code:
+ /Library/Calendars/
- /Library/*
to have Calendars/ included... This works! However, this only works for Calendars/.
So by the same token, I should be able to include Application Support/ alone. However, I want to include, again, only select folders in Application Support/... Thus, I'll do the same thing I did for /Library and Calendars/ with the subdirectory.
Code:
+ /Library/Application Support/Adium 2.0/
+ /Library/Application Support/Firefox/
+ /Library/Application Support/Cyberduck/
+ /Library/Application Support/Camino/
+ /Library/Application Support/
+ /Library/Calendars/
- /Library/Application Support/*
- /Library/*
Success! So the trick is not exclude the folder as a whole, but exclude everything in the folder. I had to include the parent subdirectory of the third level directories I wanted to include, but also exclude everything in that parent subdirectory (as illustrated with the red text)!
RTFM really works! I won't tell you I didn't read it before I came here in desperation because that would be a lie.
Woo!