Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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. –  B. Roland 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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.