Re: downloading only specific directories from directory tree

2017-01-20 Thread Kevin Korb
An include only overrides an exclude that follows it.  So, you would
need something like this:

+ */
+ openSUSE_13.2/***
- *

Then add --prune-empty-dirs to your rsync command line.  I left off the
initial ** because it doesn't really mean anything unless openSUSE_13.2
isn't always the entire directory name in which case 1 * would do.

Another way to explain it is that by default everything is included.  An
exclude rule makes exceptions.  An include rule makes exceptions to the
exclude rule.

On 01/20/2017 06:08 PM, Istvan Gabor wrote:
> Hello:
> 
> I have read rsync manual and several howtos on how to use rsync, still
> I don't know if it's doable what I want to do, and if yes, how.
> 
> The scenario:
> 
> I would like to make a local copy of openSUSE 13.2 repositories.
> I use openSUSE linux.
> 
> The repos are located in a multi-level directory structure, eg:
> 
> ftp://ftp.halifax.rwth-aachen.de/opensuse/repositories/
> 
> Let's call this directory the root dir.
> 
> Each directory in the root has subdirectories, and one of the
> subdirectories
> is named "openSUSE_13.2". The openSUSE_13.2 dir can be one, two, or more
> level
> downstairs in the root dir, eg:
> 
> http://download.opensuse.org/repositories/Apache/openSUSE_13.2/
> http://download.opensuse.org/repositories/Apache:/MirrorBrain/openSUSE_13.2/
> 
> 
> There are plenty of directories in the root dir, and each subdirectory can
> have several subdirectories.
> 
> Is it possible, using rsync, to download only all "openSUSE_13.2"
> directories with
> their contents, without specifying directly one by one every subdirectory
> to be included or excluded?
> 
> I tried to use filters.txt file with content:
> 
> + **openSUSE_13.2/***
> 
> with this command:
> 
> rsync -av --include-from=filters.txt
> rsync://ftp.halifax.rwth-aachen.de/opensuse/repositories/ ./
> 
> This downloads every directory. How can I exclude those are not
> openSUSE_13.2?
> 
> Thanks,
> 
> Istvan
> 

-- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
Kevin Korb  Phone:(407) 252-6853
Systems Administrator   Internet:
FutureQuest, Inc.   ke...@futurequest.net  (work)
Orlando, Floridak...@sanitarium.net (personal)
Web page:   http://www.sanitarium.net/
PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,



signature.asc
Description: OpenPGP digital signature
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

downloading only specific directories from directory tree

2017-01-20 Thread Istvan Gabor

Hello:

I have read rsync manual and several howtos on how to use rsync, still
I don't know if it's doable what I want to do, and if yes, how.

The scenario:

I would like to make a local copy of openSUSE 13.2 repositories.
I use openSUSE linux.

The repos are located in a multi-level directory structure, eg:

ftp://ftp.halifax.rwth-aachen.de/opensuse/repositories/

Let's call this directory the root dir.

Each directory in the root has subdirectories, and one of the 
subdirectories
is named "openSUSE_13.2". The openSUSE_13.2 dir can be one, two, or 
more level

downstairs in the root dir, eg:

http://download.opensuse.org/repositories/Apache/openSUSE_13.2/
http://download.opensuse.org/repositories/Apache:/MirrorBrain/openSUSE_13.2/

There are plenty of directories in the root dir, and each subdirectory 
can

have several subdirectories.

Is it possible, using rsync, to download only all "openSUSE_13.2" 
directories with
their contents, without specifying directly one by one every 
subdirectory

to be included or excluded?

I tried to use filters.txt file with content:

+ **openSUSE_13.2/***

with this command:

rsync -av --include-from=filters.txt 
rsync://ftp.halifax.rwth-aachen.de/opensuse/repositories/ ./


This downloads every directory. How can I exclude those are not 
openSUSE_13.2?


Thanks,

Istvan

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: Ownership and permissions when syncing directory contents

2017-01-20 Thread John Lane

> 
> That is as documented. You are requesting that the directory is synced
> to c, preserving all attributes (due to -a) so rsync does that.
> 

Ah... the attributes of the containing directory are transferred to the
containing directory on the destination.

I read that but failed to absorb it. I guess it could clarify that,
where there are multiple source directories, it's the FIRST containing
directory's attributes that are transferred.

But thanks, that explains it.


-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: Ownership and permissions when syncing directory contents

2017-01-20 Thread Paul Slootman
On Fri 20 Jan 2017, John Lane wrote:
> 
> When you rsync a directory, say `$rsync mydir/ ...` with the trailing
> slash, the destination directory is changed to the ownership,
> permissions and timestamp of `mydir`.

> $ rsync -a a/ b/ c
> $ ls -ld c
> drwxr-xr-x 2 john users 4096 Jun 15  1985 c
> 
> The directory 'c' now has the timestamp of the file 'a'
> 
> Furthermore, if the copy is done with root, the ownership and
> permissions of the file are also propagated to the directory. Note the
> destination directory gains the properties of the first source directory
> with a trailing slash.

That is as documented. You are requesting that the directory is synced
to c, preserving all attributes (due to -a) so rsync does that.


Paul

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Ownership and permissions when syncing directory contents

2017-01-20 Thread John Lane

When you rsync a directory, say `$rsync mydir/ ...` with the trailing
slash, the destination directory is changed to the ownership,
permissions and timestamp of `mydir`.

Consider this simple example

$ mkdir test
$ cd test
$ mkdir a b
$ touch -d '01 jan 1980' a/A
$ touch -d '15 jun 1985' a
$ touch -d '02 feb 1990' b/B
$ touch -d '25 aug 1995' b
$ mkdir c

Note the directory 'c' timestamp:

$ ls -ld c
drwxr-xr-x 2 john users 4096 Jan  7 20:50 c

Now, rsync:

$ rsync -a a/ b/ c
$ ls -ld c
drwxr-xr-x 2 john users 4096 Jun 15  1985 c

The directory 'c' now has the timestamp of the file 'a'

Furthermore, if the copy is done with root, the ownership and
permissions of the file are also propagated to the directory. Note the
destination directory gains the properties of the first source directory
with a trailing slash.

I am using:

rsync  version 3.1.2  protocol version 31
Linux 4.8.13-1-ARCH #1 SMP PREEMPT Fri Dec 9 07:24:34 CET 2016 x86_64
GNU/Linux

Am I using it correctly, or is this a bug or is it expected behaviour ?










-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html