Hi folks, I have a bunch of directories to mirror via rsync. I have lots of hardlinked files spread about these directories. Therfore I use -R (--relative) and -H. so far ok but: I create symlinks to the source-directories via script because src-dirs have changing names (date and time of backup) and I want to have constant directory names on target. How can I achieve that? I thought -k (--copy-dirlinks) would work but this replaces ALL symlinks to dirs which exist in the copied tree to real directories. I just want to have the "symlink dir conversion" done on the starting directories dir1 and dir2 cd /tmp/backup rsync -RaH --copy-dirlinks --stats --delete --progress dir1 dir2 dest/ dir1 and dir2 are symlinks to directories which contents have to be mirrored I want to have real directories dest/dir1 and dest/dir2 after rsyncing and not only the symlink copied. Using -k (--copy-dirlinks) the following hapens: src1/usr/bin/X11 -> . becomes dest/src1/X11/X11/X11 (and so on) because the symlink to "." gets a copy of the contents of the directory src1/usr/bin/ I could do bind mounts for src1 and src2 but normaly I try to avoid bind mounts How do I mirror the contents of name name changing directories when I want to use fixed directorynames at destination. My symlink to dir approach was not successfull. Thanks lopiuh -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20131202/f1704551/attachment.html>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Drop the --copy-dirlinks and add a trailing / to your sources: rsync -RaH --stats --delete --progress --itemize-changes dir1/ dir2/ dest/ itemize-changes is always nice too ;) On 12/02/13 14:21, - wrote:> Hi folks, > > I have a bunch of directories to mirror via rsync. I have lots of > hardlinked files spread about these directories. Therfore I use -R > (--relative) and -H. > > so far ok but: > > I create symlinks to the source-directories via script because > src-dirs have changing names (date and time of backup) and I want > to have constant directory names on target. How can I achieve that? > > > I thought -k (--copy-dirlinks) would work but this replaces ALL > symlinks to dirs which exist in the copied tree to real > directories. I just want to have the "symlink dir conversion" done > on the starting directories dir1 and dir2 > > cd /tmp/backup rsync -RaH --copy-dirlinks --stats --delete > --progress dir1 dir2 dest/ > > dir1 and dir2 are symlinks to directories which contents have to be > mirrored I want to have real directories dest/dir1 and dest/dir2 > after rsyncing and not only the symlink copied. Using -k > (--copy-dirlinks) the following hapens: > > src1/usr/bin/X11 -> . becomes dest/src1/X11/X11/X11 (and so on) > because the symlink to "." gets a copy of the contents of the > directory src1/usr/bin/ > > I could do bind mounts for src1 and src2 but normaly I try to avoid > bind mounts > > How do I mirror the contents of name name changing directories when > I want to use fixed directorynames at destination. My symlink to > dir approach was not successfull. > > Thanks > > lopiuh > >- -- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ Kevin Korb Phone: (407) 252-6853 Systems Administrator Internet: FutureQuest, Inc. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: http://www.sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlKc3xUACgkQVKC1jlbQAQfs3QCeOAWpDJn7xzuddX3fkjwmg4tO F84AoPLIUNNXqWlRmEAJiyrpCcvH77wc =xItV -----END PGP SIGNATURE-----
Hi Kevin, thanks. I'll try this again. I did before but got the impression that on subsequent runs, rsync would not recursivly run through dir1 and dir2. I hope I just was very tired ;-) another topic: Do you have an idea if rsync could delete "dir3" if dest/ consists of dir1 dir2 dir3 and I use rsync -RaH --stats --delete --progress --itemize-changes dir1/ dir2/ dest/ Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20131202/2ae96b23/attachment.html>
Apparently Analagous Threads
- rsync deleting symbolic link unexpectedly
- --keep-dirlinks --delete erroneously deletes symlinks to directories
- Using --keep-dirlinks : recursive symlinks problem
- error on --copy-dirlinks shortform in manpage
- [Bug 13587] New: Add a --dry-run way to show destination for each item