--exclude patterns

Randy Dunlap rdunlap at xenotime.net
Mon Jan 28 23:00:08 GMT 2008


On Sat, 26 Jan 2008 10:27:03 -0800 Wayne Davison wrote:

> On Fri, Jan 25, 2008 at 06:02:07PM -0800, Randy Dunlap wrote:
> > rsync --include='/test/runs/***' \
> > --exclude='--exclude=/test/runs/? --exclude=/test/runs/?? --exclude=/test/runs/??? --exclude=/test/runs/1???' \
> > -avz -e ssh --progress --delete $srcdir $dest:$destdir/
> 
> Firstly, the weird option-inside-of-an-option thing is wrong.  Eliminate
> the --exclude=' prefix and ' suffix.  Secondly, your include matches all
> the things you're trying to exclude and comes before them, so none of
> the excludes will have any effect.  Since including is the default, you
> can just eliminate that option.  And finally, we need to know what
> $srcdir is to know if your excludes are based properly.  If $srcdir is
> /test/runs/, then your excludes need the dir prefixes removed:
> 
> --exclude='/?' --exclude='/??' --exclude='/???' --exclude='/1???'
> 
> If $srcdir is /test/runs (w/o the trailing slash) add in a "/runs"
> prefix, etc.  (Absolute exclude names should always match the verbose
> output with a prefixed slash to anchor it.)

Sorry about the missing information.  Here's the script,
which still isn't working.

Any help/suggestions would be wonderful.
---
~Randy


#! /bin/sh
# rsync /test/runs/ to $server:~rdunlap/pub/kerneltest/reports/runs/

rsync_one() {
        srcdir=$1
        dest=$2
        destdir=$3

        rsync $EXCLUDE -avz -e ssh --progress --delete $srcdir $dest:$destdir/
}

#1
EXCLUDE="--exclude='/?' --exclude='/??' --exclude='/???' --exclude='/1???'"
rsync_one /test/runs/ rdunlap at server pub/kerneltest/reports/runs

# end.



More information about the rsync mailing list