copy or listing problem
Matthew Seaman
m.seaman at infracaninophile.co.uk
Fri Jun 18 08:10:42 PDT 2004
On Fri, Jun 18, 2004 at 05:58:18PM +0300, Giorgos Keramidas wrote:
> On 2004-06-18 13:23, Henrik W Lund <henrik.w.lund at broadpark.no> wrote:
> > Yavuz Ma?lak wrote:
> > >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 could do it with a shell script:
> >
> > [SOF]
> > #!/bin/sh
> >
> > for file in *
> > do
> > if [ -f "$file" ]
> > then
> > cp "$file" "$target_dir" #Define $target_dir yourself
> > fi
> > done
> > [EOF]
>
> Please note that this is very likely to fail at the expansion of
> `for file in *' in very much the same way as `cp *' fails.
>
> A better alternative is to start copying one level up or use xargs(1):
>
> find . -maxdepth 1 | xargs -J '@' cp -Rp '@' /destination/path
>
> or something similar.
# find . -depth -print0 | cpio -p0dmu /destination/path
Cheers,
Matthew
--
Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks
Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614 Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040618/9d39faec/attachment.bin
More information about the freebsd-questions
mailing list