Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #11749

Re: rsync: exclude all, then include only specified, wildcard problems..

From MarkA <someone@somewhere.invalid>
Newsgroups comp.os.linux.misc
Subject Re: rsync: exclude all, then include only specified, wildcard problems..
Date 2014-08-14 21:53 +0000
Organization NewsGuy - Unlimited Usenet $23.95
Message-ID <lsjb4j21mk7@news4.newsguy.com> (permalink)
References <kpsi1n$37d$1@dont-email.me> <87vc59rvk5.fsf@araminta.anjou.terraraq.org.uk> <e234d578-23e3-4d6b-978f-253b4740b52c@googlegroups.com>

Show all headers | View raw


On Thu, 14 Aug 2014 09:25:14 -0700, RichieHH wrote:

> On Thursday, June 20, 2013 11:16:42 AM UTC+2, Richard Kettlewell wrote:
>> David <david@55952163-3189045.bogus.domain.invalid> writes:
>> 
>> > I am trying to write a shell script to use rsync to sync certain
>> > files to
>> 
>> > another location on the same computer. (The files are checked out
>> > from a
>> 
>> > subversion repository into the source location and need to be
>> > transferred
>> 
>> > to their final location, and have ownership and permission changes.)
>> 
>> 
>> >
>> > Just in case something has inadvertently found its way into the
>> > source
>> 
>> > location that shouldn't have (eg, a file that was checked in in the
>> > wrong
>> 
>> > place or some other human error), I want to essentially first of all
>> 
>> > exclude everything in the source folder from being synced, and then
>> 
>> > explicitly allow only the folder hierarchies that are supposed to be
>> 
>> > synced.
>> 
>> 
>> 
>> That seems like a weird way to do it.  Why not just copy the
>> directories
>> 
>> you're interested in, each in a separate call to rsync (or cp)?
>> 
>> 
> because that would be somewhat silly when it can be done in one sweep
> and you dont need to specifically specify each directory you're
> interested in.

Look at the "FILTER RULES" section of the rsync man page.  It says: 
"...rsync checks each name to be transferred against the list of include/
exclude patterns in turn, and the first matching pattern is acted on..."

IOW, by putting "exclude everything" as the first rule, rsync has nothing 
to do.  Specify the directories/files you want to transfer, THEN "exclude 
everything" will exclude whatever has not been matched.

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: rsync: exclude all, then include only specified, wildcard problems.. RichieHH <rileyrg@gmail.com> - 2014-08-14 09:25 -0700
  Re: rsync: exclude all, then include only specified, wildcard problems.. William Unruh <unruh@invalid.ca> - 2014-08-14 18:07 +0000
  Re: rsync: exclude all, then include only specified, wildcard problems.. Rich <rich@example.invalid> - 2014-08-14 18:20 +0000
  Re: rsync: exclude all, then include only specified, wildcard problems.. MarkA <someone@somewhere.invalid> - 2014-08-14 21:53 +0000

csiph-web