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 SkipVought 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

Status
Not open for further replies.

glav

MIS
Mar 11, 2003
11
0
0
US
I wrote a script to clean log files in a certain directory that are more than 3 days old but get the error "The parameter list is too long". Here is the command:

find *.log -mtime +3 -exec rm {} \;

Any idea how to clean these files automatically? Why am I getting this error? Thanks in advance for an help.
 
You could use

echo *.log|xargs rm

or

for i in *.log ; do
rm $i
done

Give the first a try

You get the error because the problem with the wild card is that the shell expands /*.log into a string that's too large to fit in the kernel's argument string
buffer. This is a kernel parameter that's defined in
/usr/include/ to give a 128KB buffer for the argument list.
You could change it and rebuild the kernel, but it's better to learn how do do things without generating long argument lists for a command.




--
| Mike Nixon
| Unix Admin
|
----------------------------
 
I use this format for similar clean-up activities.

find *.log -mtime +3 |xargs rm
 
I will give that a try. Sounds like a good solution.

thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top