Since you guys are already using find, you could just pass the command
to it directly to do the deletion.  I'm thinking of something like this:

find -name '*.txt' -exec rm {} \;

Now, this would delete them one at a time, but that's probably okay in
this situation.  You might have to put quotes around the {}, if you have
some text files that have spaces in the name, etc.

Maybe I'm not understanding the problem, though.

Lloyd Brown

Eduardo Sanz Garcia wrote:
> 
>>>> You can also use a bash for loop:
>>>>
>>>> for myfile in *.txt ; do rm "$myfile" ; done
>>>>      
>>>>
>>> or:
>>>
>>> find *.txt | while read f; do rm "$f" ; done
>>>
>>> That avoids the problem of the commandline being too long (shell
>>> expansion will sometimes cause your command to fail if there are too
>>> many files.
>>>    
>>>
>> If you want to avoid expansion, you should have said:
>>
>> find -name '*.txt' | while read f; do rm "$f" ; done
>>
>> Bash and its pesky quoting rules...
>>  
>>
> The quotes are *absolutely* necessary, if not:
> /usr/bin/find: Argument list too long
> 
> --------------------
> BYU Unix Users Group 
> http://uug.byu.edu/ 
> 
> The opinions expressed in this message are the responsibility of their
> author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
> ___________________________________________________________________
> List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
> 
> 
> 

--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to