cp: Argument list too long

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Michael Wittman
Date:  
Subject: cp: Argument list too long
On Wed, Dec 11, 2002 at 09:25:57AM -0700, Bill Jonas wrote:
> On Mon, Dec 09, 2002 at 10:53:20PM -0700, Michael Wittman wrote:
> > Then run the command:
> > find /mydir/myfiles -name \*.pdf -print0 | xargs -0 -n 2500 -s 10000 cp-files
> ...
> > Normally you don't need to create a separate script to use with xargs, but
> > cp (and mv) have the peculiar property that the last argument is special.
>
> No need to in this case, either:
>
> find /mydir/myfiles -name \*.pdf -print0 | xargs -0 -i cp "{}" /newdir


That's true, but it forces xargs to invoke "cp" once for each file,
rather than once for every several thousand. That will take a lot longer
if you're dealing with hundreds of thousands of files.

-Mike