/bin/cp: cannot execute [Argument list too long] – [solved]

When executing simple command line statements such as rm, cp or ls on a folder containing large number of files, following error is thrown:

cannot execute [Argument list too long]

Workaround this issue is to use the “find” process along with “-exec” argument, as per below example on copy statement:

find <src_path> -name "*.xml" -exec cp "{}" <destination_path> \;

note: replace “cp” with “rm” or whichever command failing due to large number of entries.


Post a Comment

Your email is never published nor shared. You're allow to say what you want...