[CentOS] rsync

Craig White
Fri, 07 Mar 2008 20:14:18 -0000

On Fri, 2008-03-07 at 19:09 +0000, Anne Wilson wrote:
> On Friday 07 March 2008 18:40:03 Craig White wrote:
> > I've gone over and over the man page and I don't get it and
it's
> > obviously a simple task
> >
> > I want to rsync a directory but only the pdf files...
> >
> > rsync -ncauv --include=*.pdf $WORKING $WEB_SERVER
> > # sync's everything, I want to exclude stuff
> >
> > rsync -ncauv --filter='+ *.pdf' --filter='+ *.odt *.ott
*.eps' \
> > $WORKING $WEB_SERVER
> > # sync's everything...does not seem to exclude anything
> >
> > rsync -ncauv --filter='. /root/scripts/qm_manual_filter' \
> > $WORKING $WEB_SERVER
> > # cat qm_manual_filter
> > - *
> > + *pdf
> >
> > excludes everything
> >
> > I am using -n for dry-run
> > I definitely need recursive but -a option handles that
> >
> I don't know if it would work, but could you
> use --exclude-from=/path/to/skiplist.txt to exclude everything then use
your
> filter line to add .pdfs back?
>
> I've not tried adding anything back after excluding.  You can certainly
use
> wild cards in your skiplist, such as *.odt *.ott *.eps
----
doesn't work...

(from script)
rsync -ncauv --exclude-from='/root/scripts/qm_manual_filter' \
 --include='**/*.pdf' $WORKING $WEB_SERVER

# ./sync-qm_manual.scr
building file list ... done

sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00

no files but changing qm_manual_filter to specifics...

# cat qm_manual_filter
#+ **/*pdf
#- *
- *.ods
- *.odt
- *.ott
- *.eps
- Build-PDF/

did work, so I guess the simplest form is to just do this...

# tail -n 1 script...
rsync -ncauv \
--filter='. /root/scripts/qm_manual_filter' \
$WORKING $WEB_SERVER

# cat qm_manual_filter
+ **/*pdf
- *.ods
- *.odt
- *.ott
- *.eps
- Build-PDF/

which ultimately does what I want, I think.

Thanks

Craig