--include option

Nitin Agarwal nitin.agarwal at timesgroup.com
Tue Aug 13 22:50:02 EST 2002


Rather u can make two files, name the first one as includelist and second one as
exclude list.
Make entries of all the files u want to include in rsync in file "includelist" and
entries of files to be excluded in "excludelist".

then give the command:
rsync -avz ...... --include-from=includelist --exclude-from=excludelist
...........rest command continues....

This will work well..

If anybody has faced any problems in doing the synchronisation this way, please let
me know, so that i can be prepared for them..

:-)

Nits

"Leaw, Chern Jian" wrote:

> Hi Wayne,
>
> I tried your suggestion, but did not work. It still copied the entire
> filesystem across to the destination machine.
> I tried having the following:
> + /*/clock_speed
> + /*/fub_layout
> - /*
>
> AND
> + circuit_design/clock_speed
> + circuit_design/fub_layout
> - /*
>
> AND
> + /stor/circuit_design/clock_speed
> + /stor/circuit_design/fub_layout
> - /*
>
> Could you explain to me the idea of having the +, -, and /* ? Do the number
> of /* indicate the subdirectory levels before arriving at the directory to
> include?
>
> The other alternative you suggested below works well:
> rsync -avz /stor/circuit_design/{clock_speed,fub_layout}
>         mickey.willowglen.com:/stor/circuit_design/
>
> But I would like to have these include list into a file, as I'd be having
> many other sub-directories to include, yet exclude.
>
> Appreciate it if you could help me out.
>
> Thanks.
>
> -----Original Message-----
> From: Wayne Davison [mailto:wayned at users.sourceforge.net]
> Sent: Tuesday, August 13, 2002 12:57 AM
> To: Leaw, Chern Jian
> Cc: 'rsync at lists.samba.org'
> Subject: Re: --include option
>
> On Mon, 12 Aug 2002, Leaw, Chern Jian wrote:
> >       # rsync -avz --include-from=files_included  /stor/circuit_design/
> > mickey.willowglen.com:/stor/circuit_design/
>
> The problem with your command is that it contains include directives but
> no exclusions, so nothing limits the default operation of sending the
> entire subdirectory contents.  An easier way to go for this specific
> problem is to ignore includes and specify two source dirs, like this:
>
>     rsync -avz /stor/circuit_design/{clock_speed,fub_layout}
>         mickey.willowglen.com:/stor/circuit_design/
>
> The above assumes your shell has {} expansion, like bash and zsh.  If it
> does not, just mention both directories separately (without any trailing
> slash).  The trailing slash on the destination isn't required, but it
> doesn't hurt either, so I left it in.
>
> To make things work with your include-using command, you'd need to use
> something like this in your include file:
>
> + /clock_speed
> + /fub_layout
> - /*
>
> This allows the two directories you want, and excludes everything else
> in the base directory of the transfer.  Since none of the rules apply to
> files deeper than the base dir, none of them will be excluded.
>
> ..wayne..
> --
> To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
> Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html




More information about the rsync mailing list