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 Advanced UNIX and Linux questions go here. Expert-to-Expert.

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 06:50 AM
Fatal error: Command failed for target `build_crypto' sayed_021 SUN Solaris 1 02-13-2008 08:16 AM
Failed to check status code in "rsh" command nir_s Shell Programming and Scripting 9 07-03-2006 06:05 AM
Failed to get value from a file using sed command nir_s Shell Programming and Scripting 2 03-11-2006 01:53 PM
Solaris 9: make: Fatal error:Command failed for target eldiego UNIX for Dummies Questions & Answers 2 10-28-2005 12:11 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-11-2008
Registered User
 

Join Date: Aug 2004
Posts: 141
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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 ?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-11-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 2,983
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
look into 'man xargs'
Reply With Quote
  #3 (permalink)  
Old 05-11-2008
Registered User
 

Join Date: Feb 2007
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 187
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
  #4 (permalink)  
Old 05-12-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 2,253
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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?
Reply With Quote
  #5 (permalink)  
Old 05-13-2008
Registered User
 

Join Date: Dec 2005
Location: Pune
Posts: 78
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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.
Reply With Quote
  #6 (permalink)  
Old 05-15-2008
Registered User
 

Join Date: Aug 2004
Posts: 141
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
How to find ARG_MAX on the AIX ?
Reply With Quote
  #7 (permalink)  
Old 05-15-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 2,253
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
The page I linked above has a script which works on some platforms. I'd appreciate if you could report back here.
Reply With Quote
  #8 (permalink)  
Old 05-16-2008
Registered User
 

Join Date: Aug 2004
Posts: 141
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Hi Vgersh

I am getting following error -

AIX 3 00C185BF4C00
Arg_Max.sh[13]: cpp: not found

or gcc not found.
Reply With Quote
  #9 (permalink)  
Old 05-16-2008
Registered User
 

Join Date: Oct 2007
Location: USA
Posts: 383
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Code:
getconf ARG_MAX
Reply With Quote
  #10 (permalink)  
Old 05-16-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 2,253
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
If you don't have a C compiler installed, I don't know how you could find it out. Maybe there is some sort of interface on AIX for printing out kernel constants? Or maybe somebody in the AIX forum could run this for us? I posted a separate thread. There's probably no point in continuing in this thread on this particular topic.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash exec bash for loop command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix find grep find mtime find null character in a unix file grep multiple lines grep or grep recursive hp-ux ifconfig inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime ping port remove first character from string in k shell replace space by comma , perl script rsync ftp scp recursive segmentation fault(coredump) sftp script snoop unix solaris change ip address stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix internals unix interview questions unix mtime unix simulator unix.com vi substitute while loop within while loop shell script


All times are GMT -7. The time now is 03:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101