Re: exclude option for rsync

2008-11-09 Thread Cameron Simpson
On 10Nov2008 00:21, Ryan Sawhill <[EMAIL PROTECTED]> wrote:
| > One little known feature of rsync is the fact that when run over a
| > remote shell (such as rsh or ssh) you can give any shell command as
| > the remote file list. The shell command is expanded by your remote
| > shell before rsync is called. [...]
| 
| Little-known indeed--I didn't know rsync could do that.. that's really cool.

I have mixed feelings about this coolness myself, having tripped over it
several times. It means that if you're trying to name
files-with-spaces-or-other-weirdness precisely you need to quote twice, once
locally as with any shell command, and then again for the remote shell. It's
doable, and even automatable (provided you trust there's a Bourne/POSIX shell
at the far end, otherwise of course the far end quote syntax will be
different...)

Cheers,
-- 
Cameron Simpson <[EMAIL PROTECTED]> DoD#743
http://www.cskk.ezoshosting.com/cs/

The only way to deal with bureaucrats is with stealth and sudden violence.
- UN Secretary General Boutros-Ghali, _New York Times_ 15oct93

-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines


Re: exclude option for rsync

2008-11-09 Thread Ryan Sawhill
>
> One little known feature of rsync is the fact that when run over a
> remote shell (such as rsh or ssh) you can give any shell command as
> the remote file list. The shell command is expanded by your remote
>
> shell before rsync is called. For example, see if you can work out
> what this does:
>
>   rsync -avR remote:'`find /home -name "*.[ch]"`' /tmp/
>
> note that that is backquotes enclosed by quotes (some browsers don't
> show that correctly).
>
> not sure how to make this work.
>

Little-known indeed--I didn't know rsync could do that.. that's really cool.
So for a little more explanation, say you have a directory tree /database,
and you want to sync only the files that were changed in the last ten days.
You should be able to do something like the following:

rsync -av REMOTEHOST:'$(find /database -ctime -10)' /local/database/mirror
which would be about the same as
rsync -av REMOTEHOST:'$(find /database -not -ctime +10)'
/local/database/mirror

The difference between using find's ctime and mtime options: mtime will only
change if the actual file data has changed, whereas ctime includes both file
data and metadata--permissions, ownership info, file name, etc.

Hope that helps!
-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

Re: exclude option for rsync

2008-11-09 Thread L
On Mon, Nov 10, 2008 at 10:54 AM, Cameron Simpson <[EMAIL PROTECTED]> wrote:

> On 10Nov2008 09:56, L <[EMAIL PROTECTED]> wrote:
> | I use rsync to sync a mirror site. I wnat to exclude files that were
> created
> | more than 10 days ago. I have  a long list of excludes in a file. But I
> want
> | a dynamic option.
> | what is the option for this in rsync ?
>
> As far as I'm aware there isn't one. The include/exclude stuff is
> entirely pathname based. I have in the past done a recursive _listing_
> of a mirror site, chosen files out of that, and constructed an
> include/exclude file on that basis. This was automated with a script.
>
> In my case the example was a GNU archive with multiple versions of
> packages; I wished only to mirror the "latest" package.
>
> If you can construct (via, perhaps, "rsync -n" and some postprocessing)
> a list of the remote files that you want, or do not want, it is a pretty
> easy task to convert that into an include/exclude list automatically. Then
> you just use that in a wrapper script for calling rsync.
>
> Cheers,
> --

at the bottom of rsync example page @
http://www.samba.org/rsync/examples.html

it says

Fancy footwork with remote file lists


One little known feature of rsync is the fact that when run over a
remote shell (such as rsh or ssh) you can give any shell command as
the remote file list. The shell command is expanded by your remote
shell before rsync is called. For example, see if you can work out
what this does:

rsync -avR remote:'`find /home -name "*.[ch]"`' /tmp/

note that that is backquotes enclosed by quotes (some browsers don't
show that correctly).


not sure how to make this work.

Y



>
> Cameron Simpson <[EMAIL PROTECTED]> DoD#743
> http://www.cskk.ezoshosting.com/cs/
>
> MS-DOS: "... an OS originally designed for a microprocessor that modern
> kitchen appliances would sneer at"
>- Dave Trowbridge, _Computer Technology Review_, Aug '90
>
> --
> fedora-list mailing list
> fedora-list@redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
> Guidelines:
> http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
>
-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

Re: exclude option for rsync

2008-11-09 Thread Cameron Simpson
On 10Nov2008 09:56, L <[EMAIL PROTECTED]> wrote:
| I use rsync to sync a mirror site. I wnat to exclude files that were created
| more than 10 days ago. I have  a long list of excludes in a file. But I want
| a dynamic option.
| what is the option for this in rsync ?

As far as I'm aware there isn't one. The include/exclude stuff is
entirely pathname based. I have in the past done a recursive _listing_
of a mirror site, chosen files out of that, and constructed an
include/exclude file on that basis. This was automated with a script.

In my case the example was a GNU archive with multiple versions of
packages; I wished only to mirror the "latest" package.

If you can construct (via, perhaps, "rsync -n" and some postprocessing)
a list of the remote files that you want, or do not want, it is a pretty
easy task to convert that into an include/exclude list automatically. Then
you just use that in a wrapper script for calling rsync.

Cheers,
-- 
Cameron Simpson <[EMAIL PROTECTED]> DoD#743
http://www.cskk.ezoshosting.com/cs/

MS-DOS: "... an OS originally designed for a microprocessor that modern
kitchen appliances would sneer at"
- Dave Trowbridge, _Computer Technology Review_, Aug '90

-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines


exclude option for rsync

2008-11-09 Thread L
Hi,
I use rsync to sync a mirror site. I wnat to exclude files that were created
more than 10 days ago. I have  a long list of excludes in a file. But I want
a dynamic option.

what is the option for this in rsync ?

best
Y
-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines