From owner-freebsd-questions Mon Jul 3 2:26:11 2000 Delivered-To: freebsd-questions@freebsd.org Received: from ngo.org.uk (ngo.org.uk [193.62.43.28]) by hub.freebsd.org (Postfix) with ESMTP id 4ADF037B530 for ; Mon, 3 Jul 2000 02:25:57 -0700 (PDT) (envelope-from mac@ngo.org.uk) Received: (from mac@localhost) by ngo.org.uk (8.9.3/8.9.3) id KAA17220; Mon, 3 Jul 2000 10:26:07 +0100 (BST) From: Mac Message-Id: <200007030926.KAA17220@ngo.org.uk> Subject: Re: Erasing files ... In-Reply-To: from Pedro Hernandez at "Jun 30, 0 05:56:26 pm" To: pedro@hci.com.mx Date: Mon, 3 Jul 2000 10:26:06 +0100 (BST) Cc: freebsd-questions@freebsd.org X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi all, Pedro Hernandez Wrote > Thanks Jonathan, Ian, and Matthew: > > I've just found solution with find / -name "-z" -delete. > > Your way didn't function Ian, but thank you anyway. Here's the real way, and it works on all forms of UNIX, no need for special 'find' command options (or special 'rm' options, which are (IMHO) a complete abomnination) Just use the FULL path name. So to remove '-z' in the root directory use:- rm /-z or, more generally, if you're in a directory with a file named '-dfg' use:- rm ./-dfg and finally, for those really awkward (to type) filenames (like ones with three embeded Carrige Returns and the odd Form Feed character) use something like:- rm -i ./* (although it's wise to double check that '-i' is a feature of the 'rm' command you're using.) Two other notes whilst I'm thinking about it. Files with '/' inside the name can't be deleted with 'rm' at all. You're into directly editing the filesystem (but you'd have to have a buggy kernel to get a file like that in the first place, so you're very unlucky if that happens to you). Also, DO NOT set up 'rm' as an alias (shell function, etc.) to 'rm -i' to protect yourself from occasional typos. You'll get used to it being there, and one day when you're not on your home system you'll expect it to work and it won't. If you must have that functionality, then name the alias something else (e.g. 'alias mr rm-i'). Better still treat 'rm' with the care it deserves. There's miles of difference between:- 'rm -r /pcnfs/*' and 'rm -r /pcnfs /*' :) Just My Thoughts. Mac To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message