Exclude not working
hashproduct+rsync at gmail.com
Mon Jul 9 22:18:10 GMT 2007
On 7/9/07, Giuliano Gavazzi <dev+lists at humph.com> wrote:
> On 9 Jul 2007, at 08:17, Madhavan Chari wrote:
> > This is how I am trying to exclude the directories. All the
> > directories have sub-directories also.
> > E1=/opt/mscdr/arb821/Server/transmissionData
> > E2=/opt/mscdr/arb821/Server/logs
> > E3=/opt/mscdr/arb821/Server/temp
> > E4=/opt/mscdr/arb821/Server/altavista
> > rsync -az -t -e ssh -vv --delete --exclude $E1 --exclude $E2 --
> > exclude $E3 --exclude $E4 --delete-excluded --bwlimit=1000
> > $HOSTTOBACKUP:$SOURCE $TARGET >$tempfile 2>&1
> you did not append "/" to your exclude patterns and you did not show
> us the value of the SOURCE macro. Either might explain the failure.
All a trailing "/" would do is prevent the pattern from matching a
non-directory, so its absence can't be the problem. More likely is
the $SOURCE. Rsync interprets an exclude pattern that begins with /
relative to the root of the transfer, i.e., $SOURCE. Thus, if $SOURCE
is (say) /opt/mscdr/arb821/ , then the exclude patterns should be
Alternatively, you can keep the patterns as they are but tell rsync to
interpret them from the root of the filesystem by using --filter with
the / modifier:
rsync (...) --filter="-/ $E1" --filter="-/ $E2" --filter="-/ $E3"
If you have a lot of exclude patterns, consider putting them in an
exclude file instead of giving them all on the command line.
More information about the rsync