Date: Fri, 18 Jun 2004 17:58:18 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Henrik W Lund <henrik.w.lund@broadpark.no> Cc: freebsd-questions@freebsd.org Subject: Re: copy or listing problem Message-ID: <20040618145818.GA20561@orion.daedalusnetworks.priv> In-Reply-To: <40D2D095.1080702@broadpark.no> References: <1e3201c45522$c393f840$dc96eed5@maslak> <40D2D095.1080702@broadpark.no>
next in thread | previous in thread | raw e-mail | index | archive | help
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
> >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.
- Giorgos
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040618145818.GA20561>
