Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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? ;-)

share|improve this question
I don't get the idea. If you make, for example, a symlink named /tmp/somedirectory pointing at /home/me/somegreatdir, then all the contents of somegreatdir will be visible under /tmp/somedirectory. This needs just one symlink for the entire tree. Or what else do you want? – jankes Nov 12 '11 at 23:41
up vote 14 down vote accepted

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.

share|improve this answer
Also my first attempt. Failed to get cp to create symlink for source/some_deeper_dir/files. – Jokester Apr 2 '13 at 16:29

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.