29

I am seeking for a command that would re-create a whole tree of files in a different directory. I would prefer to have all symlinks absolute. Can I do that with a find and xargs? ;-)

lzap
  • 1,021

3 Answers3

37

cp -rs source/ dest/ should do the trick. The directory structure will be recreated at dest/ with each file being a symlink to its counterpart in source.

10

In case cp -rs is not the answer you're looking for, lndir might be the correct answer.

0

Or you can do in this way:

ln -s /etc/nginx/sites-available/* /etc/nginx/sites-enabled/

This will symlink all files in sites-available folder to sites-enabled