[lug] rsync exclude/include

Hugh Brown hugh at math.byu.edu
Thu Sep 18 14:50:43 MDT 2003


I am a having a bear of a time trying to get rsync to behave for me.

I'm trying to rsync javadoc from numerous projects to a web server.

Directory structure is as follows:

/build/src/<projectname>/javadoc/

on the server I want to have /web/api/javadoc/<projectname>/javadoc/

I don't know ahead of time what the project names will be, so I do and
"ls -d /build/src/*/javadoc" to see which ones have javadoc built and
then use awk to grab the project name.  I have tried doing this for
rsync but I am having no luck (the include isn't matching anything)


cd  /build/src

  /usr/bin/rsync --verbose \
                 --update \
                 --relative \
                 --archive \
                 --compress \
                 --delete \
                 -n \
                 --include="/*/javadoc/**" \
                 --exclude="*" \
                 ${PROJECT} \
                 server:/web/api/javadoc/



each project has other files and directories in it.

The way I read the rsync man page the include should match against the
whole path, the first directory can be anything (I'm looping through the
project names and the first directory will be the project), the next
directory will be javadoc, and then ** will match any number of subdirs
and files.  The exclude then matches everything else.

What have I done wrong/misunderstood?

Hugh




More information about the LUG mailing list