Date: Fri, 18 Jun 2004 16:09:22 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: freebsd-questions@freebsd.org Subject: Re: copy or listing problem Message-ID: <20040618150922.GB82217@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <20040618145818.GA20561@orion.daedalusnetworks.priv> References: <1e3201c45522$c393f840$dc96eed5@maslak> <40D2D095.1080702@broadpark.no> <20040618145818.GA20561@orion.daedalusnetworks.priv>
next in thread | previous in thread | raw e-mail | index | archive | help
--+pHx0qQiF2pBVqBT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
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@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=20
> > >another directory. but when I started to copy them I got error as belo=
w;
> > >/bin/cp: Argument list too long.
>=20
> > You could do it with a shell script:
> >=20
> > [SOF]
> > #!/bin/sh
> >=20
> > for file in *
> > do
> > if [ -f "$file" ]
> > then
> > cp "$file" "$target_dir" #Define $target_dir yourself
> > fi
> > done
> > [EOF]
>=20
> 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.
>=20
> A better alternative is to start copying one level up or use xargs(1):
>=20
> find . -maxdepth 1 | xargs -J '@' cp -Rp '@' /destination/path
>=20
> or something similar.
# find . -depth -print0 | cpio -p0dmu /destination/path
Cheers,
Matthew
--=20
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
--+pHx0qQiF2pBVqBT
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)
iD8DBQFA0wWiiD657aJF7eIRAgVqAJ4sM82o+da1vVhoz9jQKHnBRVqkxQCgmY2o
67seKQ622tMCcntv1vN1JCA=
=XMf9
-----END PGP SIGNATURE-----
--+pHx0qQiF2pBVqBT--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040618150922.GB82217>
