cp: Argument list too long
Bill Earl
plug-discuss@lists.plug.phoenix.az.us
Mon, 9 Dec 2002 14:15:19 -0700
This is a multi-part message in MIME format.
------=_NextPart_000_09F6_01C29F8D.678B9040
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello everyone!
I need to copy, and occasionally move, some directories that contain =
thousands of files, (like around 250,000 pdfs), and the problem I'm =
having is that in the Bash shell, both cp and mv commands seem to die at =
somewhere around 3,000 files, so that if I enter
cp /mydir/myfiles/*.pdf /newdir/
I get the following error:
bash: /bin/cp: Argument list too long. =20
I noticed that even just trying to list this many files can cause this =
error, depending on the syntax used. "ls /mydir/myfiles/*.pdf" generates =
the Argument list too long error, but "ls /mydir/myfiles" displays fine.
I can get around it using a python script and more fiddling around than =
I really want to do. I'd really like to be able to move these large =
numbers of files around just through the shell.
Is anyone aware of a separate file copying or moving (I need to do both, =
depending on the situation) utility that can handle very large numbers =
of files? Would switching to a different shell solve this (if so, which =
one?), or is it a limit on the cp and mv commands?
Thanks!
Bill Earl
Network Admin
Spectrum Data Solutions, LLC
www.bestbill.com
------=_NextPart_000_09F6_01C29F8D.678B9040
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4919.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello everyone!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I need to copy, and occasionally move, =
some=20
directories that contain thousands of files, (like around 250,000 pdfs), =
and the=20
problem I'm having is that in the Bash shell, both cp and mv commands =
seem to=20
die at somewhere around 3,000 files, so that if I enter</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>cp /mydir/myfiles/*.pdf =
/newdir/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I get the following error:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>bash: /bin/cp: Argument list too =
long. =20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I noticed that even just trying to list =
this many=20
files can cause this error, depending on the syntax used. "ls=20
/mydir/myfiles/*.pdf" generates the Argument list too long error, but =
"ls=20
/mydir/myfiles" displays fine.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I can get around it using a python =
script and more=20
fiddling around than I really want to do. I'd really like to be =
able to=20
move these large numbers of files around just through the =
shell.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Is anyone aware of a separate file =
copying or=20
moving (I need to do both, depending on the situation) utility that can =
handle=20
very large numbers of files? Would switching to a different shell =
solve=20
this (if so, which one?), or is it a limit on the cp and mv=20
commands?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Bill Earl<BR>Network Admin<BR>Spectrum =
Data=20
Solutions, LLC<BR><A=20
href=3D"http://www.bestbill.com">www.bestbill.com</A></FONT></DIV></BODY>=
</HTML>
------=_NextPart_000_09F6_01C29F8D.678B9040--