From: Bill Cunningham on
Does anyone know of a quick way I can delete files from a list? I
untarball'd my gcc and directed stdout to a list. Can I make a few changes
in bash, C, or perl to erase the files listed?

Bill


From: James Harris on
On 15 May, 23:56, "Bill Cunningham" <nos...(a)nspam.invalid> wrote:
>     Does anyone know of a quick way I can delete files from a list? I
> untarball'd my gcc and directed stdout to a list. Can I make a few changes
> in bash, C, or perl to erase the files listed?

Since you mention bash I assume you are on a Unix-like OS. Check out
xargs. You can use it with rm but remember to use it carefully and
consider the -0 (zero) option if your files have spaces in their
names.

James
From: Moi on
On Sat, 15 May 2010 18:56:27 -0400, Bill Cunningham wrote:

> Does anyone know of a quick way I can delete files from a list? I
> untarball'd my gcc and directed stdout to a list. Can I make a few
> changes in bash, C, or perl to erase the files listed?
>
> Bill

The easiest way IMHO would be to edit the file with the filenanames,
prepending "rm " to each of the names, and then treat the file as a shell
script. Other ways would involve some shell programming skills
, and would be more error-prone.

assuming your file is named 'killbill', and contains one filename
per line, and you use vi::

vi killbill
:%s/^/rm /g
:wq

sh killbill

That's all.

HTH,
AvK
From: Bill Cunningham on

"Moi" <root(a)invalid.address.org> wrote in message
news:5c108$4befd5bb$5350c024$8526(a)cache110.multikabel.net...

> The easiest way IMHO would be to edit the file with the filenanames,
> prepending "rm " to each of the names, and then treat the file as a shell
> script. Other ways would involve some shell programming skills
> , and would be more error-prone.
>
> assuming your file is named 'killbill', and contains one filename
> per line, and you use vi::
>
> vi killbill
> :%s/^/rm /g
> :wq
>
> sh killbill
>
> That's all.

Great that helps alot! Just calling on vi assume is what your doing. The
thing is I only wanted to enter one command to delete all files in the text
file. That is a bash shell script now.

Bill


From: Bill Cunningham on

"James Harris" <james.harris.1(a)googlemail.com> wrote in message
news:fb2f79c9-77b4-4d75-ba94-5fc01dbae464(a)o12g2000vba.googlegroups.com...

Since you mention bash I assume you are on a Unix-like OS. Check out
xargs. You can use it with rm but remember to use it carefully and
consider the -0 (zero) option if your files have spaces in their
names.

I have text like this,

/usr
/usr/lib
/usr/lib/gcc
/usr/lib/gcc/ and then this goes one until all the files have been placed.
Can I include all the text into a variable and then just rm -fr ...var
and get rid of that? xargs is a little complicated to the first time viewer.

Bill