CP: max source files number arguments for copy utility


Today we have a problem: We get this error when we try to copy over 32356 file in other folder.
[root@mail server-xv.ro]# cp -p office_23\@domain.ro/new/1* office\@domain.ro/.Inbox_2016_06_23/cur/
-bash: /bin/cp: Argument list too long

Solutions: run your command in a loop.

[root@mail server-xv.ro]# for file in office_23\@domain.ro/new/*; do cp -p “$file” office\@domain.ro/.Inbox_2016_06_23/cur/; done

And works very well.

Leave a Reply

Your email address will not be published. Required fields are marked *

6 + 9 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.