rm


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting rm
# 1  
Old 09-15-2008
rm

hi,

I am trying to delete files using script:-

find . -name "*.xml" | xargs rm *

but i am getting an error "/usr/bin/xargs: Arg list too long"


Could you please help me out with this, or if it could be done using for or while loop.....please helpSmilie...........Thanks in advance!!!
# 2  
Old 09-15-2008
you could use something like:

find . -name "*.xml" | while read temp_file
do
rm $temp_file
done
# 3  
Old 09-15-2008
don't pipe to rm *! This will remove everything in the current directory!


try this

Code:
find . -name "*.xml" |xargs rm

or

Code:
find . -name "*.xml" -exec rm {}  \;

Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question