Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jun 2004 11:40:01 -0400 (EDT)
From:      Jerry McAllister <jerrymc@clunix.cl.msu.edu>
To:        bmalik@ihlas.net.tr (=?iso-8859-9?Q?Yavuz_Ma=FElak?=)
Cc:        freebsd-questions@freebsd.org
Subject:   Re: copy or listing problem
Message-ID:  <200406181540.i5IFe4c26083@clunix.cl.msu.edu>
In-Reply-To: <1e3201c45522$c393f840$dc96eed5@maslak> from "=?iso-8859-9?Q?Yavuz_Ma=FElak?=" at Jun 18, 2004 01:55:26 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Hello
> I use freebsd4.9
> I have thousands of files in my any directory. and I need to copy them 
> to another directory. 
> but when I started to copy them I got error as below;
> /bin/cp: Argument list too long.


You didn't include the command you used, but I it was something
like:    cp * /otherdir/.

That '*' on there makes the shell feed it all the file names on
the command line.  eg, the globbing function adds in all the file
names before it is handed over to the cp command and since there are
huge numbers of files, it makes the command line too long.

> 
> Do I have to copy them in pieces ?

You can try that.

When I am too lazy or foggy to think up a find or script segment
I often do something like:
  cp a* /otherdir/.
  cp b* /otherdir/.
  etc,

But, it is possible for there to be too many files in some alphabet
clumps even for that.

A couple of other people have suggested pairing a find with the copy.
That is the officially good way to go, but find can seem tricky to use
at times.  

////jerry

> 
> What shall I do ?
> 
> Thanks 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
> 
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406181540.i5IFe4c26083>