I have a symlink to an important directory. I want to get rid of that symlink, while keeping the directory behind it.
I tried rm
and get back rm: cannot remove 'foo'
.
I tried rmdir
and got back rmdir: failed to remove 'foo': Directory not empty
I then progressed through rm -f
, rm -rf
and sudo rm -rf
Then I went to find my back-ups.
Is there a way to get rid of the symlink without throwing away the baby with the bathwater?
rm -r link/
deletes the content on the target – Hanusrm
it. Without the-r
and-f
it will not delete directories" – Courtesyrm foo
vsrm foo/
. Tab completion in bash will add the slash. That slash makes rm try to treat it as a directory. Without -r or -f it will fail, then the inexperienced will google the error message and be told to use -r. And loose data. Neither of the proposed related questions explain the / issue. As far as I can tell only the accepted answer here has that explanation, on the whole internet. – Candancecandela