On 2004-06-18 13:23, Henrik W Lund <[EMAIL PROTECTED]> 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

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to