Operating System - HP-UX
1834942 Members
2165 Online
110071 Solutions
New Discussion

ERROR : /sbin/mv: Arg List or Environment too large

 
Amit Dixit_2
Regular Advisor

ERROR : /sbin/mv: Arg List or Environment too large

Hi,
When I give any command on my SCO unix
(cp,mv,tar) it gives me error message


ERROR : /sbin/mv: Arg List or Environment too large

Please tell me how to move my
file from
/oracle1/oracle8/OraHome/admin/jhab1/arch/*.dbf to /user/myfolder/arch/

Thanks,
Amit
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: ERROR : /sbin/mv: Arg List or Environment too large

It is telling you exactly what's wrong. The shell is expanding the wildcards to a list so big that it exceeds a maximum size. If you have a kernel tunable something like ncargmax then you can increase and build a new kernel but the most sensible approach is to break the requst into smaller pieces.

You would help a lot by simply cd'ing to the source directory so that the pathnames are much shorter.
cd oracle1/oracle8/OraHome/admin/jhab1/arch/
cp *.dbf /user/myfolder/arch/

If that is still too large then
cp [0-1]*.dbf /user/myfolder/arch/
cp [1-2]*.dbf /user/myfolder/arch/
and so on substituting your leading characters for [0-1].

Plan B:
cd oracle1/oracle8/OraHome/admin/jhab1/arch/
find . -type f -name '*.dbf' | cpio -pudvm /user/myfolder/arch/


If it ain't broke, I can fix that.
Michael Schulte zur Sur
Honored Contributor

Re: ERROR : /sbin/mv: Arg List or Environment too large

Hi,

I hope, SCO has xargs, which cuts the huge lists into portions, mv can handle.

hth,

Michael
Hein van den Heuvel
Honored Contributor

Re: ERROR : /sbin/mv: Arg List or Environment too large

As Clay wrote, this message is pretty descriptive: The argument list is too large!

Now this may me an artificial limit imposed by the OS to satisfy a standard. This was the case for Tru64. There it was controlled with: sysconfig -q proc exec_disable_arg_limit
This by default/ OOTB was set to 0, and just setting that to 1 allowed extreme argument lists. SCO may well have somethign similar.

In the mean time, just divide and conquer!
Do mv blah/blah/A* followed by mv blah/blah/B* and so on.
If that is too tedious... script it!
If that makes too many chunks, use smarter wildcard like : mv blah/blah/[ABCD]*

Good luck!
Hein.
Elmar P. Kolkman
Honored Contributor

Re: ERROR : /sbin/mv: Arg List or Environment too large

Michaels solution should work:
ls /oracle1/oracle8/OraHome/admin/jhab1/arch | grep '.dbf$' | xargs -I FiLe mv FiLe /user/myfolder/arch

It might even be you can do the mv command by not using the full path name of all files to copy... This way only the dbf files are on the resulting command line instead of the absolute pathnames of all dbf files. A lot shorter!

Try this:
cd /oracle1/oracle8/OraHome/admin/jhab1/arch
mv *.dbf /user/myfolder/arch
Every problem has at least one solution. Only some solutions are harder to find.
KapilRaj
Honored Contributor

Re: ERROR : /sbin/mv: Arg List or Environment too large

I think this is to do with the number of files present even an ls would also fail if thereb are many.

My sugession is to use find so that you get the absolute path and then move it one by one in a loop

for FILE in `find /oracle1/oracle8/OraHome/admin/jhab1/arch -name *.dbf -print`
do
mv $FILE /user/myfolder/arch
done

Kaps
Nothing is impossible