From owner-freebsd-questions Wed Feb 26 12:31:21 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7A17137B401 for ; Wed, 26 Feb 2003 12:31:19 -0800 (PST) Received: from 12-229-238-38.client.attbi.com (12-229-238-38.client.attbi.com [12.229.238.38]) by mx1.FreeBSD.org (Postfix) with SMTP id BA7B243F93 for ; Wed, 26 Feb 2003 12:31:18 -0800 (PST) (envelope-from ryallsd@datasphereweb.com) Received: (qmail 38641 invoked from network); 27 Feb 2003 20:29:50 -0000 Received: from unknown (HELO bartxp) (192.168.0.2) by 12-229-238-38.client.attbi.com with SMTP; 27 Feb 2003 20:29:49 -0000 From: "Derrick Ryalls" To: "'Steve Warwick'" , Subject: RE: Deleting a soft link that points to a directory - how? Date: Wed, 26 Feb 2003 12:29:04 -0800 Message-ID: <00f001c2ddd5$b72df490$0200a8c0@bartxp> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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