Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unix cp argument list too long

Tags:

unix

ksh

aix

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.

like image 390
lamwaiman1988 Avatar asked May 05 '11 03:05

lamwaiman1988


People also ask

How do you overcome arguments too long in Unix?

If there are a large number of files in a single directory, Then the traditional rm command can not delete all files and ends with an error message Argument list too long . To resolve this issue and delete all files use xargs command-line utility with the find command.

How do I fix arguments too long in Linux?

There are a number of solutions to this problem (bash: /usr/bin/rm: Argument list too long). Remove the folder itself then recreate it. If you still need that directory, then recreate with the mkdir command.

How do you grep an Argument list too long?

/bin/grep: Argument list too long. A second option to overcome the error is: substitute the “ * ” (asterisk) with a “ . ” (dot), like: grep -r "example\.com" . In newer versions of grep you can omit the “ .

What is given as first Argument in cp command?

You use the cp command for copying files from one location to another. This command can also copy directories (folders). [file/directory-sources] specifies the sources of the files or directories you want to copy. And the [destination] argument specifies the location you want to copy the file to.


1 Answers

Use find command in *nix:

find ./00012524 -type f -name "*.PDF" -exec cp {} ./dummy01/ \; -print
like image 187
anubhava Avatar answered Nov 04 '22 11:11

anubhava