Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a directory that contains a link to another directory that I just created. I would like to remove the link but preserve the directory my link was pointing to. How do I do this?

> mkdir rgac
> ln -s /actual_dir_with_data/ /rgac/
share|improve this question

2 Answers 2

up vote 4 down vote accepted

rm /rgac/actual_dir_with_data should do nicely (you created a link probably called actual_dir_with_data in /rgac). Don't worry, rm(1) doesn't remove directories unless specifically told to do so. And you can then delete only /rgac by rmdir /rgac (see rmdir(1)).

Probably what you wanted to do was ln -s /actual_dir_with_data /rgac

share|improve this answer

Do the following:

rm -rf /rgac
share|improve this answer
    
Giving arbitrary commands without explaining what they do isn't the best way to help someone. Could you explain why that command would help? –  maxmackie Mar 6 '13 at 2:48
4  
More to the point, that does exactly the opposite of what he's asking. –  Shadur Mar 6 '13 at 5:41
1  
Please do not use rm -Rf lightly. Plain rm would suffice; you should be slightly scared every time you add -Rf to that, and not do it unless you actually must. –  derobert Mar 7 '13 at 17:11

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.