0

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.

4
  • You mean automatically?
    – koni_raid
    Apr 24, 2012 at 7:21
  • Just remove the symlink from the location, and recreate it.
    – antivirtel
    Apr 24, 2012 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, 2012 at 7:31
  • I don't think so.
    – koni_raid
    Apr 24, 2012 at 8:38

1 Answer 1

2

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.

1
  • 7zipping the folder made all work for me. :D
    – Drozd
    Apr 24, 2012 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .