So that title isn’t exact…as most of you should know, you cant create hard links for directories…you also can’t create hard links across filesystems….there are pretty obvious and more technical reasons for that.

So the alternative is to create the dirs and hard link the files in the dirs…which if done manually using ln continuously, would be painful. However, the cp command can do it for you in one fell swoop!

cp -R -l ../../awsesomedirsource .

^That will create “awseomedirsource” in the cwd and then recursively place hard links to the files in the original directory in this new directory (and make any other subdirs etc..)

Pretty nifty!

Blog Logo

Mario Loria




Because gets old after a while.

Back to Overview