[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rsync's --exclude= syntax
On Sun, 2007-04-15 at 20:50 -0500, Steven Pritchard wrote:
> On Sat, Apr 14, 2007 at 07:07:38PM -0500, Robert G. (Doc) Savage wrote:
> > As is so often the case with Linux/UNIX utilities, the man page for
> > rsync lacks the syntax details to make the --exclude= option work. I'm
> > trying to avoid rsyncing the following remote files and directories:
> > .cgf-stage/
> > .stage-cgf/
> > mail-archives/
> > tmp/
> > .message
> > SYNC_STAMP.txt
> > The following variations do NOT work:
> > --exclude='./.cgf-stage/ ./.stage-cgf/ ./mail-archives/ ./tmp/ ./.message ./SYNC_STAMP.txt'
> > --exclude='.cgf-stage/ .stage-cgf/ mail-archives/ tmp/ .message SYNC_STAMP.txt'
> > What will???
> --exclude .cgf-stage/ \
> --exclude .stage-cgf/ \
> --exclude mail-archives/ \
> --exclude tmp/ \
> --exclude .message \
> --exclude SYNC_STAMP.txt
That did it. Thanks.
Now that my script is working, it may be time to send a bug report to
the rsync maintainer(s). The man page very clearly includes the "=" and
"'" (single quote) characters in its syntax examples. The use of the "="
character with the --exclude statement, however, will cause it to fail.
Furthermore, there appears to be no syntax with single or double quotes
that allows you to define a string of elements to be associated with an
To Steve Reindl, Tim Hart, and Brian Fitzwater: the syntax of the
--exclude-from file is one element per line. When using the
--exclude-file statement in a script, relative paths to the file (e.g.
~/filename) may be ambiguous and fail.
For everyone, the object of this exercise was a script that allows me to
rsync the Cygwin project. U.Cal Berkeley creates DVD images every 3-6
months and used to allow outsiders to download them. When they began
blocking outsider downloads, I had to create my own capability:
$ cat /usr/local/bin/rsync-cygwin
# This script will synchronize files and directories from the Cygwin
# mirror at Argonne National Laboratories to a local directory.
rsync -DHPclprtv --exclude .cgf-stage/ --exclude .stage-cgf/ --exclude mail-archives/ --exclude tmp/ --exclude .message --exclude SYNC_STAMP.txt rsync://mirror.mcs.anl.gov/cygwin/ .
# -D same as --devices --specials
# -H preserve hard links
# -P same as --partial --progress
# -c skip based on checksum, not mod-time & size
# -l copy symlinks as symlinks
# -p preserve permissions
# -r recurse into directories
# -t preserve times
# -v increase verbosity
# --exclude files and directories from the source
The output can be copied to a 4GB thumb drive or burned a DVD. The first
time it is run this script will pull down 5,059 files totaling 3.6GB.
Depending upon the speed of your connection, this may take more than 24
hours. Subsequent rsyncs will take about 15 minutes.
To unsubscribe, send email to firstname.lastname@example.org with
"unsubscribe silug-discuss" in the body.