cp -l
hard links files instead of copying them, saving filesystem space. I need to use rsync instead of cp because of its --exclude
capabilities.
So my question is, how do I get rsync to hard link files instead of copying them? Obviously, this is a local filesystem copy. I've read the docs for rsync's -H
option, but it's unclear to me if this behaves the same way as cp -l
.
Best Answer
The answer has turned out to be yes, with rsync's
--link-dest
option. It's just not obvious because it's not a simple on/off flag likecp -l
, because it takes a path argument.So,
cp -l a/ b/
can also be done like this: