LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-19-2003, 08:48 AM   #1
martint
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Rep: Reputation: 0
Cannot remove symbolic link to directory.


I have
~/dir1/dir2
and created a symbolic link to dir2:
ln -s ~/dir1/dir2 ~/symlink

Now I can't remove symlink! I get the errors:

$rm symlink/
rm: cannot remove directory 'testsymboliclink/': Is a directory
$rmdir symlink/
rmdir: 'testsymboliclink/': Not a directory

This is REALLY weird. I even cannot

$unlink symlink/
unlink: 'testsymboliclink/': Not a directory

I can't even remove the link, if the dir is empty. Please help me...

Last edited by martint; 11-19-2003 at 11:45 AM.
 
Old 11-19-2003, 08:52 AM   #2
Lostman
Member
 
Registered: Nov 2003
Location: Chicago, IL
Posts: 238

Rep: Reputation: 30
Just use the remove dir command for the link dir. I assume that link is in a different dir, so just

rmdir /path/to/where/the/link/is
 
Old 11-19-2003, 09:26 AM   #3
martint
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
I think you dont understand my problem:

When I use rm, it says "Is a directory"
When I use rmdir, it says "Not a directory"
Thats quite absurd...

I've tried to use both relative and absolute paths, none of them works.
 
Old 11-19-2003, 02:51 PM   #4
Mikhail_16
Member
 
Registered: Oct 2003
Distribution: Gentoo rules them all
Posts: 279

Rep: Reputation: 31
DUDE, its
'rm symlink' (without '/' on the end)
 
1 members found this post helpful.
Old 11-19-2003, 06:43 PM   #5
martint
LQ Newbie
 
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
Ahh, thanks!
That must be the first (and last) disadvantage of _tab-completion_ :-)
 
Old 03-24-2007, 02:50 AM   #6
DrDom
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
It's all in the completion...

If you do "rm target/", then rm assumes target is a directory without doing any further checking.

Someone should patch rm to remove this stupid behavior...

XOX DOM

Last edited by DrDom; 03-24-2007 at 02:52 AM.
 
Old 09-17-2014, 08:45 PM   #7
aplusplus
LQ Newbie
 
Registered: Sep 2014
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by Lostman View Post
Just use the remove dir command for the link dir. I assume that link is in a different dir, so just

rmdir /path/to/where/the/link/is
Thank you! This really works.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check if a parent directory is a symbolic link compnovice Linux - Newbie 11 10-06-2005 05:59 PM
Is there a way to remove a symbolic link Philter Linux - Newbie 3 11-30-2004 06:24 PM
Can't remove symbolic link kimchee411 Linux - Newbie 1 10-06-2004 02:25 AM
directory symbolic link resolution rusti999 Linux - Software 6 08-09-2004 04:13 PM
Symbolic link bwaynej2002 Linux - General 8 08-25-2003 10:06 PM


All times are GMT -5. The time now is 03:29 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration