Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Feb 2003 12:29:04 -0800
From:      "Derrick Ryalls" <ryallsd@datasphereweb.com>
To:        "'Steve Warwick'" <ukla@attbi.com>, <freebsd-questions@FreeBSD.ORG>
Subject:   RE: Deleting a soft link that points to a directory - how?
Message-ID:  <00f001c2ddd5$b72df490$0200a8c0@bartxp>
In-Reply-To: <BA8262DD.43E7%ukla@attbi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> I cannot seem to delete a soft link (ln -s) that is pointing 
> to a directory without renaming the directory first. If I try 
> to delete the link it complains that the link is a directory 
> (which it is pointing to). If I delete using rm -rf, it 
> deletes the directory that is pointed to but not the link -- 
> I have been burned by that one!
> 
> FreeBSD 4.3
> 
> Here is a little test:
> 
> %pwd
> /tmp
> %mkdir me
> %cd /root
> %ln -s /tmp/me MyTmp
> %rm -f MyTmp/
> rm: MyTmp/: is a directory
> %
> %rm -rf MyTmp/  (deletes the directory it points to)
> %rm -f MyTmp    (deletes the link)
> %

Try not using the trailing slash:

===[root] /data/test # ls
===[root] /data/test # ln -s /tmp/me MyTmp
===[root] /data/test # ls
MyTmp@
===[root] /data/test # rm -f MyTmp/
===[root] /data/test # ls
MyTmp@
===[root] /data/test # rm MyTmp
===[root] /data/test # ls
===[root] /data/test # 


Also, don't do is as root like me :)



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00f001c2ddd5$b72df490$0200a8c0>