RE: [lug-nuts] FW: cool way to rm files

From: Lancashire, Andrew (LancashireA@sutterhealth.org)
Date: Fri Jan 14 2000 - 08:22:35 PST


How timely this all was. I had accidentally created a file from the output
of another command. The file name was "-sT" (without the quotes
obviously). I had tried several ways to delete it and could not. The one
I used successfully was ls|xargs -n1 --interactive rm -- , thank you Harry
Souders, it worked like a charm.

Andrew
-----Original Message-----
From: Brian Lavender [mailto:brian@brie.com]
Sent: Thursday, January 13, 2000 10:48 PM
To: Lug Nuts
Subject: [lug-nuts] FW: cool way to rm files

Harry posted this to vox. It should help with any rm problems.
Check the bottom of the message for his cool command.

brian

----- Forwarded message from Harry Souders <gnulinux@rosecomputing.com>
-----

Date: Wed, 29 Dec 1999 16:40:28 -0800
From: Harry Souders <gnulinux@rosecomputing.com>
To: vox@lists.mother.com
Subject: Re: oh brother...
X-Mailer: Mutt 0.95.3i
In-Reply-To: <19991229155708.A4901@gollum.wormley.com>; from Steve Wormley
on Wed, Dec 29, 1999 at 03:57:08PM -0800
Precedence: bulk
Reply-To: vox@lists.mother.com

On Wed, Dec 29, 1999 at 03:57:08PM -0800, Steve Wormley wrote:
> > you can see me getting more and more desperate with each try. i give
up.
> > what's the trick here?
> >
> > pete
> rm ./-g

This might work too:

rm -- -g

The - in the file is a problem because rm thinks you are giving it an
option (ie ls -l ). The '--' in the example above tells rm that
everything after it is not an option.

So, I'm thinking about this problem and thought...

Hey! What if I had a directory full of oddball filenames that I wanted
to delete, but I only wanted to delete certain ones? Well, you could
interactively delete the files you want with this:

ls|xargs -n1 --interactive rm --

----- End forwarded message -----

-- 
Brian Lavender
http://www.brie.com/brian/
****************************************************************************
* To UNSUBSCRIBE from the list, send a message with "unsubscribe lug-nuts"
* in the message body to majordomo@saclug.org. Please direct other
* questions, comments, or problems to lug-nuts-owner@saclug.org.

**************************************************************************** * To UNSUBSCRIBE from the list, send a message with "unsubscribe lug-nuts" * in the message body to majordomo@saclug.org. Please direct other * questions, comments, or problems to lug-nuts-owner@saclug.org.



This archive was generated by hypermail 2b29 : Fri Feb 25 2000 - 14:29:10 PST