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!

arg list too long

Status
Not open for further replies.

knyam

Technical User
Mar 18, 2004
16
0
0
ZW
hello
i am receiving the following error message whenever i want to copy files from one directory to another

/bin/cp: arg list too long

what could be the cause of this?
 
Hi. Checkout:

Thread58-868145

I want to be good, is that not enough?
 
What is your actual code raising the error ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I've never traced the cause but can state that the number of files you are attempting to copy exceeds a list limit of some sort within unix.
My solution has been to copy part of the files , a* for example, then move the copied files to a parallel directory temporarily, then the b* and down the list the same way until the number of files remaining can be handled at one time. Then move the original files back into place.

This is probably a configurable value somewhere, it just doesn't happen enough with the stuff I work with to spend time tracing it down.



Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
sorry my internet link was down. I managed to solve the problem by coping the whole directory and not individual files.

i am going to do some housekeeping from my working directory files so as to get the directory size small.

thank you for the response once again
 
Anyway, the standard way is to use xargs

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
edfair said:
This is probably a configurable value somewhere, it just doesn't happen enough with the stuff I work with to spend time tracing it down.

I was curious whether this was a shell or utility limitation, and did some testing. On a randomly chosen system (HP-UX 11.11, ksh88) it appears to be the utilities themselves that complain (I tried ls and cp), returning error code E2BIG when they are execve()'d by the shell. It doesn't appear to be the quantity of parameters that trigger this, more the number of characters supplied; I seemed to hit this limit around the 2046310 byte mark on this particular system. I tried 1,000,000 single character parameters and it accepted that fine.

I doubt there is a parameter that controls this; I presume it is a predefined constant compiled into the various utilities.

As PHV said, xargs is the elegant answer.

Annihilannic.
 
Oops, didn't notice I was in the SCO forum. In any case I don't have a SCO box to play with any more...

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top