Rsync a directory via a linked name.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Rsync a directory via a linked name.

Hongyi Zhao
Hi all,

See the following for detail:

$ rsync -l ftp.cn.debian.org::debian/dists/wheezy/main/installer-amd64/
[snip]
drwxr-sr-x          4,096 2015/01/10 18:17:33 .
lrwxrwxrwx             18 2015/01/10 18:16:31 current -> 20130613+deb7u2
+b4
drwxr-xr-x          4,096 2013/05/01 05:33:52 20130430
drwxr-sr-x          4,096 2015/01/05 17:25:32 20130613+deb7u2+b4

In the above case, the current is a link to 20130613+deb7u2, I want to
use the name of link directory, i.e., current, to retrieve the correspond
stuff from remote server to my local host.  At the same time, exclude all
of the other stuff in the installer-amd64 directory, for this case, it
should be the directory 20130430.

Considering that the sub-directories in installer-amd64 are often be
renamed except the link directory name `current', so I want to only use
the `current' as the directory name in my include/exclude rules for the
above jobs.

Any hints on how to write this rsync rules?

Regards
--
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Rsync a directory via a linked name.

Kevin Korb
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just go 1 deeper for your source: rsync -l
ftp.cn.debian.org::debian/dists/wheezy/main/installer-amd64/current/

On 04/16/2015 06:21 AM, Hongyi Zhao wrote:

> Hi all,
>
> See the following for detail:
>
> $ rsync -l
> ftp.cn.debian.org::debian/dists/wheezy/main/installer-amd64/
> [snip] drwxr-sr-x          4,096 2015/01/10 18:17:33 . lrwxrwxrwx
> 18 2015/01/10 18:16:31 current -> 20130613+deb7u2 +b4 drwxr-xr-x
> 4,096 2013/05/01 05:33:52 20130430 drwxr-sr-x          4,096
> 2015/01/05 17:25:32 20130613+deb7u2+b4
>
> In the above case, the current is a link to 20130613+deb7u2, I want
> to use the name of link directory, i.e., current, to retrieve the
> correspond stuff from remote server to my local host.  At the same
> time, exclude all of the other stuff in the installer-amd64
> directory, for this case, it should be the directory 20130430.
>
> Considering that the sub-directories in installer-amd64 are often
> be renamed except the link directory name `current', so I want to
> only use the `current' as the directory name in my include/exclude
> rules for the above jobs.
>
> Any hints on how to write this rsync rules?
>
> Regards
>

- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
        Kevin Korb Phone:    (407) 252-6853
        Systems Administrator Internet:
        FutureQuest, Inc. [hidden email]  (work)
        Orlando, Florida [hidden email] (personal)
        Web page: http://www.sanitarium.net/
        PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUv018ACgkQVKC1jlbQAQfxsgCcDRssw7zIMHzmjhwTt/PINj7t
EM0AnRckJoeebESMugMkzua7YXQYpoUM
=1JSQ
-----END PGP 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
Reply | Threaded
Open this post in threaded view
|

Re: Rsync a directory via a linked name.

Hongyi Zhao
On Thu, 16 Apr 2015 11:21:03 -0400, Kevin Korb wrote:

> Just go 1 deeper for your source: rsync -l
> ftp.cn.debian.org::debian/dists/wheezy/main/installer-amd64/current/

Yes, I've tried this before.  But I also use the `--delete --delete-
excluded' with the above options.  And finally I found that the  current
will not be retrieved, in fact it will be deleted at the end.

Then I noted the following args of rsync:

-L, --copy-links            transform symlink into referent file/dir
-K, --keep-dirlinks         treat symlinked dir on receiver as dir

So I finally use the command like this and it does the trick:

rsync -rlKLPv --delete --delete-excluded \
ftp.cn.debian.org::debian/dists/wheezy/main/installer-amd64/current/

But, even though, I cann't figure out whether the method used by me is
the most appropriate method or not for this case.

Regards
--
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.

--
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
Reply | Threaded
Open this post in threaded view
|

Re: Rsync a directory via a linked name.

Kevin Korb
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Always have either --times or --archives.  Otherwise rsync will have
no idea what needs updating when you run it again.

On 04/16/2015 08:07 PM, Hongyi Zhao wrote:

> On Thu, 16 Apr 2015 11:21:03 -0400, Kevin Korb wrote:
>
>> Just go 1 deeper for your source: rsync -l
>> ftp.cn.debian.org::debian/dists/wheezy/main/installer-amd64/current/
>
>>
> Yes, I've tried this before.  But I also use the `--delete
> --delete- excluded' with the above options.  And finally I found
> that the  current will not be retrieved, in fact it will be deleted
> at the end.
>
> Then I noted the following args of rsync:
>
> -L, --copy-links            transform symlink into referent
> file/dir -K, --keep-dirlinks         treat symlinked dir on
> receiver as dir
>
> So I finally use the command like this and it does the trick:
>
> rsync -rlKLPv --delete --delete-excluded \
> ftp.cn.debian.org::debian/dists/wheezy/main/installer-amd64/current/
>
>  But, even though, I cann't figure out whether the method used by
> me is the most appropriate method or not for this case.
>
> Regards
>

- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
        Kevin Korb Phone:    (407) 252-6853
        Systems Administrator Internet:
        FutureQuest, Inc. [hidden email]  (work)
        Orlando, Florida [hidden email] (personal)
        Web page: http://www.sanitarium.net/
        PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUwT1cACgkQVKC1jlbQAQc46QCgocsn498C0Q3w7t2glHO7/12X
+r0AoNozy4/ercYd+3gqQ1eEMd9BdWIC
=WGo0
-----END PGP 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
Reply | Threaded
Open this post in threaded view
|

Re: Rsync a directory via a linked name.

Hongyi Zhao
On Thu, 16 Apr 2015 20:09:59 -0400, Kevin Korb wrote:

> Always have either --times or --archives.  Otherwise rsync will have no
> idea what needs updating when you run it again.

Thanks for your hints.

Regards
--
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.

--
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