Unix cp argument list too long

lamwaiman1988 picture lamwaiman1988 · May 5, 2011 · Viewed 28.3k times · Source

I am using AIX.

When I try to copy all the file in a folder to another folder with the following command:

cp ./00012524/*.PDF ./dummy01

The shell complains:

ksh: /usr/bin/cp: 0403-027 The parameter list is too long.

How to deal with it? My folder contain 8xxxx files, how can I copy them very fast? each file have size of 4x kb to 1xx kb.

Answer

anubhava picture anubhava · May 5, 2011

Use find command in *nix:

find ./00012524 -type f -name "*.PDF" -exec cp {} ./dummy01/ \; -print