The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with Mail command: exec failed. errno=2. hawkman2k UNIX for Dummies Questions & Answers 1 04-29-2008 10:50 AM
Fatal error: Command failed for target `build_crypto' sayed_021 SUN Solaris 1 02-13-2008 12:16 PM
Failed to check status code in "rsh" command nir_s Shell Programming and Scripting 9 07-03-2006 10:05 AM
Failed to get value from a file using sed command nir_s Shell Programming and Scripting 2 03-11-2006 05:53 PM
Solaris 9: make: Fatal error:Command failed for target eldiego UNIX for Dummies Questions & Answers 2 10-28-2005 04:11 PM

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 05-11-2008
videsh77 videsh77 is offline
Registered User
  
 

Join Date: Aug 2004
Posts: 144
rm & mv command failed due to too many files.

In our directory there are too many files, & if I try to execute mv *.gz or rm *.l command it fails, providing error string as - 'arg list too long'. This doesnt happen always, is there any way we know, limit on the rm & mv command so we can take care of this failure in future executions ?
  #2 (permalink)  
Old 05-11-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
look into 'man xargs'
  #3 (permalink)  
Old 05-11-2008
varungupta varungupta is offline
Registered User
  
 

Join Date: Feb 2007
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 206
Quote:
Originally Posted by videsh77 View Post
In our directory there are too many files, & if I try to execute mv *.gz or rm *.l command it fails, providing error string as - 'arg list too long'. This doesnt happen always, is there any way we know, limit on the rm & mv command so we can take care of this failure in future executions ?
Hey,

I have created 100 directories and deleted them using rm -r *.abc
It works.
I dont think there is some kind of limitations to remove directories.
TO REMOVE DIRECTORIES recursive "-r" is to be used when give rm command.

Otherwise please tell how many sub directories you have under the main directory, then i can simulate the situation and could give you some solutions.

Thanks.
Varun
  #4 (permalink)  
Old 05-12-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
The problem is when the wildcard expands to a string which is larger than the buffer the kernel allocates for this. Like vgersh99 said, read man xargs or How long can the command line be?
  #5 (permalink)  
Old 05-13-2008
shriashishpatil shriashishpatil is offline
Registered User
  
 

Join Date: Dec 2005
Location: Pune
Posts: 81
hope below command will solve the problem. It will run slow though...
find . -type f -exec rm -f {} \;
replace rm -f with the command you want to run.
  #6 (permalink)  
Old 05-15-2008
videsh77 videsh77 is offline
Registered User
  
 

Join Date: Aug 2004
Posts: 144
How to find ARG_MAX on the AIX ?
  #7 (permalink)  
Old 05-16-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
The page I linked above has a script which works on some platforms. I'd appreciate if you could report back here.
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 01:52 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