Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

How can I change symbolic links for targeted files? (move targeted files to place where are linked from)

I hope I'm clear.

Thank you in advance.

share|improve this question
You mean automatically? – konrad Apr 24 '12 at 7:21
Just remove the symlink from the location, and recreate it. – antivirtel Apr 24 '12 at 7:21
I can write a script to make it automatic, but is there any command? I need reverse of ln - change link to target by copying target to symlink file. – Drozd Apr 24 '12 at 7:31
I don't think so. – konrad Apr 24 '12 at 8:38

If it's not in man ln, then ln definitely cannot do it.

But this should:

find /path/to/dir -type l -exec sh -c 'cp --remove-destination "$(readlink "{}")" "{}"' \;

The quotes are to take care of file names with spaces in them.

The -exec calling into sh is to evaluate $(readlink ...) for each file.

share|improve this answer
7zipping the folder made all work for me. :D – Drozd Apr 24 '12 at 18:49

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.