Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bunch of files in one directory and links to each one of those files in another directory. So ls -l looks something like this:

lrwxrwxrwx 1 rembol rembol   89 Jan 25 10:00 copyright.txt -> /home/rembol/solr/target/deploy/data/core/copyright.txt
lrwxrwxrwx 1 rembol rembol   92 Jan 25 10:00 jar-versions.xml -> /home/rembol/solr/target/deploy/data/core/jar-versions.xml
lrwxrwxrwx 1 rembol rembol   85 Jan 25 10:00 lgpl.html -> /home/rembol/solr/target/deploy/data/core/lgpl.html
lrwxrwxrwx 1 rembol rembol   79 Jan 25 10:00 lib -> /home/rembol/solr/target/deploy/data/core/lib
lrwxrwxrwx 1 rembol rembol   87 Jan 25 10:00 readme.html -> /home/rembol/solr/target/deploy/data/core/readme.html
drwxr-xr-x 3 rembol rembol 4096 Jan 25 10:00 server
drwxr-xr-x 2 rembol rembol 4096 Jan 25 10:00 startup

Now I want to move those linked files from /home/rembol/solr/target/deploy to /home/rembol/output/. If I do that my simply calling mv, links will break. I don't want to re-link each file separately, cause there are hundreds of them (they are generated automatically).

Is there some clever way to move linked files, rather than writing a script that unlinks, moves and relinks recursively for each file in each subdirectory?

share|improve this question

migrated from stackoverflow.com Jan 25 '12 at 18:04

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

The short version is that mv can't do this. You'll need to retarget the links on your own. I was going to offer a suggestion on how to do this, but there's already a really good answer to a similar question posted over on the Unix/Linux site.

share|improve this answer
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.