Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 May 2001 17:19:30 -0500
From:      Mike Meyer <mwm@mired.org>
To:        User Ipt Ian Patrick Thomas <ipthomas_77@yahoo.com>
Cc:        questions@freebsd.org
Subject:   Re: How can I delete this file
Message-ID:  <15101.46834.852098.728904@guru.mired.org>
In-Reply-To: <90647916@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
User Ipt Ian Patrick Thomas <ipthomas_77@yahoo.com> types:
> 	I forgot to add the z flag when I extracted from a tarred file and in
> return got this file...
> 
> ?????c???-G???IR??????????I]????[?7jY?#??8?5??t???r???x?????LWL?]|?n?3b?????V??1
> S????
> 	How on earth can I delete this?

One of the oldest questions in the (unix) book. It was in the FAQ in
the 80s; I'm surprised it's not in the FreeBSD FAQ.

Couple of approaches. If there aren't many other files in the
directory with it, you can try doing "rm -i *" in that directory, and
just answer "n" to all the other files.

Another is to create an empty directory as a sibling of the one the
file is in, move everything else into the new directory, rm -rf the
old one, and rename the new one to the old name.

The approach that works if you've got lots of files you want to keep
with no naming regularity is to construct a regular expression that
only the file matches, check it with echo, then use rm on it:

<various echo commands with regular expressions>
% echo *IR*LWL*3b*
<lists only your problem file>
% rm !$

Oh yeah - if rm tries to interpret the file name as an option, you can
just use '--' after any options to tell rm that there *are* no more
options.

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

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?15101.46834.852098.728904>