Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jul 2000 10:26:06 +0100 (BST)
From:      Mac <mac@ngo.org.uk>
To:        pedro@hci.com.mx
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Erasing files ...
Message-ID:  <200007030926.KAA17220@ngo.org.uk>
In-Reply-To: <NDBBLDLJFKMIDBKILPEPEEDDCIAA.pedro@hci.com.mx> from Pedro Hernandez at "Jun 30, 0 05:56:26 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007030926.KAA17220>