Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The parameter list is too long. 1

Status
Not open for further replies.

volcano

Programmer
Aug 29, 2000
136
HK
Hi, I have thousands of log files in a directory with date and time as file name. When I try to do "rm 20051008*", the shell returns "ksh: /usr/bin/rm: 0403-027 The parameter list is too long.". I can only do "rm 20051008_090*", something like that, which is very time-consuming to me. How can I do "rm 20051008" in this case? Thanks.
 
Hi. This is a common question. Try a keyword search for 'parameter list' in this forum for a selection of solutions.
 
Hi. Try a keyword search for parameter list in this forum for a selection of possible solutions.
 
cd /directory_in_question
find ./ -name "20051008" -type d | xargs rm

I am guessing it is a directory otherwise rm would not complain because it would only be 1 file. Or if that is an extension then the find command would be "*20051008".

You can also use a for loop:
for i in /dir_in_question/20051008/*
do
rm $i
done

Good luck!
 
You also have two ways to solve your problem:

1) use a for ... do ... done loop to act on the directory where there is plenty of files.


2) you can change the system default memory alocation

smitty System Environments

Change / Show Characteristics of Operating System

ARG/ENV list size in 4K byte blocks

you may put the value up to 256 if needed but be careful, in this case, all processes will alocate this quantity of memory. I used to change it for small periods to do cleaning scripts and put it back to it's default value after.
 
gloups, 2nd solution is only valid if AIX53

HTH,

p5wizard
 
Update the system's argument length

chdev -l sys0 -a ncargs='16' (default is 6)

I've changed all mine to 32 but 16 should be sufficient.
That fixes the problem.

"If you always do what you've always done, you will always be where you've always been."
 
There are many ways to skin a cat, you can also do:
1) cd into the log directory
2) /usr/bin/find . -name "20051008*" -print -exec rm {} \;

That will work.
 
Thanks all! I think the last one is an easier and simpler solution~ Thank you again all of you.
 
The last one:
Code:
cd into the log directory
/usr/bin/find . -name "20051008*" -print -exec rm {} \;
is identical to my first response! Only it was 5 days later!!
Code:
cd /directory_in_question
find ./ -name "20051008" -type d | xargs rm
 
kHz

To be pendantic - its not

Yours does directories - he needs one for files (which 'the last one' is) :)

Alex
 
My $0.02:

Whenever I need to do a "find ... -exec rm {} \;", I first do just the find, to make absolutely sure I'll be removing exactly what needs to be removed.

so:

find /logdir/path/name -name "20051008*" -type f -print | more

if that looks OK to me

find /logdir/path/name -name "20051008*" -type f -exec rm {} \;
or
find /logdir/path/name -name "20051008*" -type f -print | xargs rm


HTH,

p5wizard
 
Close enough that the changes could have been made if one knows how to use find! [smile]
 
I tried convincing the users (especially DBA's!) to use 'find' as a workaround, but the comments about Solaris and Linux being a better OS got to me so I just increased the nargs :)


"If you always do what you've always done, you will always be where you've always been."
 
Solaris and/or Linux better than AIX? Please!!!! I have worked with all of them and AIX surpasses anything they have by far! Management utilities (smitty); volume management (LVM); disk management (lspv, lsdev, etc.); package installation, deletion, etc. (lslpp); OS upgrades; maintenance levels; patch management.

There are others too, but AIX rules the Unix world!
 
Hence our AIX team goes home at 5pm without a call all night, and the Solaris standby guys are here till 3 am!
:)


"If you always do what you've always done, you will always be where you've always been."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top