Total Pageviews

Monday, August 30, 2010

/bin/cp: Argument list too long

yesterday when i copy a files using this commands:

cp -p *.txt /home/dralnux/projects/files

i got this message (/bin/cp: Argument list too long) i want to bang my head to the floor because i need to copy all the files in a rush.

Explanation about this error:

The shell can hold a maximum of 131072 bytes for command line arguments. If you try to pass more than that number you will greeted with an error that read as follows:

Argument list too long

Remember each character requires one byte of storage.

Solution:

try to use find command for example:

find . -name ‘*.txt’ -exec cp -p {} “/tmp/dralnux” \;

and yehey it’s works :)

No comments: