I''m running 2.6.6 on a red hat EL3 system. using the following command, rsync -rlptDvzL --stats --include=a/ --include=a/dir/ --include=a/dir/symlink/ --include=a/dir/symlink/dir2/ --include=a/dir/symlink/dir2/dir3/ --exclude=''**'' /export/stuff remote::stuff I expect the "symlink" (which is really a symbolic link to a directory) to be preserved on the remote site even if dir2/dir3 doesn''t exist. Yet, when this transfer is executed under those conditions, the remote site''s symlink is removed and replaced with a directory of the same name as the symbolic link (literally "symlink" in this case). The command above is automatically generated. The idea is to copy ONLY the directory structure, creating any missing pieces of the structure on the remote system, but none of the files. Some details: on the local system, I have /export/stuff/a/dir/symlink which is a symbolic link to "dir1", which of course exists and contains dir2/dir3. local: /export/stuff/a/dir/symlink -> dir1 on the remote system, I have /export/stuff/a/dir/symlink where symlink is a link to "dir1" containing only the directory dir2 (not dir2/dir3). in other words, dir3 doesn''t exist on the remote system. remote: /export/stuff/a/dir/symlink -> dir1 When I run the command I mentioned earlier, on the remote system I get "symlink" as a real directory that contains a fully populated dir2/dir3 directory. The symbolic link that was there is now gone. note that I''m only trying to copy the directory structure, not any files contained within. What am I doing wrong? Thanks for the help. -Eric -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
On Tue, 2005-12-20 at 11:40 -0800, Eric Horne wrote:> rsync -rlptDvzL --stats --include=a/ --include=a/dir/ > --include=a/dir/symlink/ --include=a/dir/symlink/dir2/ > --include=a/dir/symlink/dir2/dir3/ --exclude=''**'' /export/stuff > remote::stuffSince you gave the -L/--copy-links option, the sending rsync pretended its symlink was a real directory, and since you didn''t give -K/--keep-dirlinks, the receiving rsync turned its symlink into a real directory to match. -L overrides -l. Take out -L and it should work. -- Matt McCutchen, ``hashproduct'''' hashproduct@verizon.net -- http://hashproduct.metaesthetics.net/
Thanks, Matt for this suggestion. My version (2.6.6) doesn''t have a keep-dirlinks option (that sounds like what I want, though). In anycase, I removed the -L, and now the structure does not get created at all. I removed -l also, and that didn''t work either. I added only the -L back, and was left with the same behaviour -- that the symlink turns into a directory. So I think I''m still stuck (or I misunderstood what you said) -Eric Matt McCutchen wrote:> On Tue, 2005-12-20 at 11:40 -0800, Eric Horne wrote: > >>rsync -rlptDvzL --stats --include=a/ --include=a/dir/ >>--include=a/dir/symlink/ --include=a/dir/symlink/dir2/ >>--include=a/dir/symlink/dir2/dir3/ --exclude=''**'' /export/stuff >>remote::stuff > > > Since you gave the -L/--copy-links option, the sending rsync pretended > its symlink was a real directory, and since you didn''t give > -K/--keep-dirlinks, the receiving rsync turned its symlink into a real > directory to match. -L overrides -l. Take out -L and it should work.
Eric, --keep-dirlnks was added in version 2.6.3, so it''s available in 2.6.6 (but both ends have to be 2.6.3 or later). Here''s an online version of the current man page: http://rsync.samba.org/ftp/rsync/rsync.html --keep-dirlinks (-K) is definitely what you need... John On Tue, 20 Dec 2005, Eric Horne <eric.horne@teradyne.com> wrote:> Thanks, Matt for this suggestion. My version (2.6.6) doesn''t have a > keep-dirlinks option (that sounds like what I want, though). > > In anycase, I removed the -L, and now the structure does not get created > at all. I removed -l also, and that didn''t work either. I added only the > -L back, and was left with the same behaviour -- that the symlink turns > into a directory. > > So I think I''m still stuck (or I misunderstood what you said) > > -Eric > > Matt McCutchen wrote: >> On Tue, 2005-12-20 at 11:40 -0800, Eric Horne wrote: >> >>>rsync -rlptDvzL --stats --include=a/ --include=a/dir/ >>>--include=a/dir/symlink/ --include=a/dir/symlink/dir2/ >>>--include=a/dir/symlink/dir2/dir3/ --exclude=''**'' /export/stuff >>>remote::stuff >> >> >> Since you gave the -L/--copy-links option, the sending rsync pretended >> its symlink was a real directory, and since you didn''t give >> -K/--keep-dirlinks, the receiving rsync turned its symlink into a real >> directory to match. -L overrides -l. Take out -L and it should work. > > -- > To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Matt straightened me all out, thanks again. Using -K -L did exactly what I wanted it to do. Now I just need to get it to work with remotes that aren''t at 2.6.3 or above (think I''ll be upgrading those) :) -Eric Matt McCutchen wrote:> On Tue, 2005-12-20 at 13:53 -0800, Eric Horne wrote: > >>Thanks, Matt.. I''ll try it. >> >>Do you happen to know which rsync version --keep-dirlinks was >>introduced? I have 2.6.6 but don''t see it as a valid argument. > > > According to OLDNEWS, --keep-dirlinks was introduced in 2.6.3. Is it > possible that your rsync man page is out of sync with your rsync > executable? See if --keep-dirlinks is listed in `rsync --help`. > > The right way to "preserve" symlinks is to use -l without -L, but having > rsync follow symlinks (-L -K) is the only way to get include filters to > apply through symlinks, which you seem to want.