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


Groups > comp.os.linux.misc > #11746 > unrolled thread

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

Started byRichieHH <rileyrg@gmail.com>
First post2014-08-14 09:25 -0700
Last post2014-08-14 21:53 +0000
Articles 4 — 4 participants

Back to article view | Back to comp.os.linux.misc

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

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

FromRichieHH <rileyrg@gmail.com>
Date2014-08-14 09:25 -0700
SubjectRe: rsync: exclude all, then include only specified, wildcard problems..
Message-ID<e234d578-23e3-4d6b-978f-253b4740b52c@googlegroups.com>
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.

[toc] | [next] | [standalone]


#11747

FromWilliam Unruh <unruh@invalid.ca>
Date2014-08-14 18:07 +0000
Message-ID<lsitsj$lj8$1@dont-email.me>
In reply to#11746
On 2014-08-14, RichieHH <rileyrg@gmail.com> 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.

Lookup the --exclude option for rsync. I really do not understand what
you want to do, but that might help you figure out for yourself.

[toc] | [prev] | [next] | [standalone]


#11748

FromRich <rich@example.invalid>
Date2014-08-14 18:20 +0000
Message-ID<lsium2$tjh$1@dont-email.me>
In reply to#11746
RichieHH <rileyrg@gmail.com> 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.

Rsync's documentation states that plural directories can be specified
on its command line, so you should be able to do the following for this
example:

app1/src
app1/obj
app1/xml

rsync app1/src app1/obj app1/xml user@machine:/other-location/app1/

and it should just sync the "src/obj/xml" subdirs.

[toc] | [prev] | [next] | [standalone]


#11749

FromMarkA <someone@somewhere.invalid>
Date2014-08-14 21:53 +0000
Message-ID<lsjb4j21mk7@news4.newsguy.com>
In reply to#11746
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.os.linux.misc


csiph-web