How would I make dir2 a copy of dir1 w/hardlinks for the files?

Linda A. Walsh rsync at
Wed Mar 26 12:22:22 MDT 2014

I have a dir "dir/"
with 2 dirs in it "a/" and "b/".

dir b/ has a file in it 'file'

dir a has a relative symlink to that file:

Ishtar:/tmp> ll dir
total 0
drwxrwxr-x 2 20 Mar 26 10:51 a/
drwxrwxr-x 2 17 Mar 26 10:49 b/
Ishtar:/tmp> ll dir/{a,b}
total 0
lrwxrwxrwx 1 9 Mar 26 10:51 symfile -> ../b/file

total 0
-rw-rw-r-- 1 0 Mar 26 10:49 file

What I want is to create a new dir, 'dir2/'  with
'file' being hardlink'ed between the two (since it's identical). 

I am not seeing how one would do this in rsync?

I keep ending up with 'file' being a separate copy in dir2...

Can rsync do this?

More information about the rsync mailing list