Page 1 of 1

Solved: How to remove a symbolic link to a directory

Posted: Wed Jun 05, 2013 6:35 pm
by mister_v
Hi,

I want to delete a symbolic link to a directory
Put it doesn't work with rm

Code: Select all

rm DIR/
rm: cannot remove 'DIR/': Is a directory
Even forcing it:

Code: Select all

rm -f DIR/
rm: cannot remove 'DIR/': Is a directory
I don't want to do rm -fr,
because it might delete everything in the directory,
and I don't want that.

Even tried "unlink"

Code: Select all

unlink DIR/
unlink: cannot unlink 'DIR/': Not a directory
Doesn't work either

Re: How to remove a symbolic link to a directory

Posted: Wed Jun 05, 2013 7:12 pm
by Chris
You need to handle it like a file.
Without the slash '/'

Code: Select all

rm DIR
This should work.

When you use tab to complete the directory-name,
it automatically adds the slash (/).
But it is not needed in this case.

Re: How to remove a symbolic link to a directory

Posted: Sun Jun 09, 2013 8:13 pm
by mister_v
Ok this was the problem.

I feel kinda stupid now.