From: utzoo!decvax!harpo!npois!cbosg!cbosgd!mark
Newsgroups: net.followup
Title: Re: rm -. and ??????
Article-I.D.: cbosgd.2348
Posted: Sat Jun 12 13:34:09 1982
Received: Sun Jun 13 04:46:35 1982
References: pyuxbb.134

Removing a file whose name contains a space is not hard, if you know
exactly what the file name is.  Just type something like
	rm "foo bar"
which quotes the space.  Globbing can also be used, e.g.
	rm foo*
if there are no other foo*'s, or
	rm foo?bar

rm -i is a useful tool if you're not sure of the file name.  However,
in some versions of UNIX (4.1BSD in particular) a buggy program can
create a file whose name contains a meta character (e.g. 0200-0377).
The kernel will create such a file, but the unlink operation strips
the parity bit, making it impossible to unlink, even with shell globbing.
(It might be the shell that strips the parity, I'm not sure.)  In
any case, a sledge hammer approach that seems to work even in this
case is to
	(1) cd to the directory, say "dir"
	(2) create a directory, say ../foo
	(3) mv * ../foo
	    This will fail on the funny file.  If you have subdirectories
	    this is harder - you have to do some work by hand.  But
	    eventually you'll get everything moved except the bad file.
	(4) cd ..
	(5) rm -rf dir
This gets rid of it.  I'm not sure if an unreachable directory entry
gets created which will be cleaned up on the next fsck, but it seems
not to even leave that.

	Mark