RE: Deleting a soft link that points to a directory - how?

2003-02-26 Thread Derrick Ryalls
 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 [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message


Re: Deleting a soft link that points to a directory - how?

2003-02-26 Thread Kirk Strauser
At 2003-02-26T20:26:05Z, Steve Warwick [EMAIL PROTECTED] writes:

 %rm -f MyTmp/
 rm: MyTmp/: is a directory
 %
 %rm -rf MyTmp/  (deletes the directory it points to)
 %rm -f MyTmp(deletes the link)
 %

 Help, suggestions, magic?

`MyTmp/' reference to the target.  `MyTmp' (without the slash) refers to the
link.  Abracadabra!
-- 
Kirk Strauser
In Googlis non est, ergo non est.


pgp0.pgp
Description: PGP signature