The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-15-2008
tushar_tus tushar_tus is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 29
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 help...........Thanks in advance!!!
  #2 (permalink)  
Old 09-15-2008
rob[hcit] rob[hcit] is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 1
you could use something like:

find . -name "*.xml" | while read temp_file
do
rm $temp_file
done
  #3 (permalink)  
Old 09-15-2008
frank_rizzo frank_rizzo is offline Forum Advisor  
Resident BOFH
  
 

Join Date: Dec 2007
Posts: 432
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 {}  \;

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0