From owner-freebsd-questions@FreeBSD.ORG Fri Jun 18 14:53:46 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F11CD16A4CE for ; Fri, 18 Jun 2004 14:53:46 +0000 (GMT) Received: from bilbo.otenet.gr (bilbo.otenet.gr [195.170.0.13]) by mx1.FreeBSD.org (Postfix) with ESMTP id C589B43D1F for ; Fri, 18 Jun 2004 14:53:44 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from orion.daedalusnetworks.priv (aris.bedc.ondsl.gr [62.103.39.226])i5IEqc7b012724; Fri, 18 Jun 2004 17:52:40 +0300 Received: from orion.daedalusnetworks.priv (orion.daedalusnetworks.priv [127.0.0.1])i5IEwoRj020581; Fri, 18 Jun 2004 17:58:50 +0300 Received: (from keramida@localhost)i5IEwIPV020580; Fri, 18 Jun 2004 17:58:18 +0300 Date: Fri, 18 Jun 2004 17:58:18 +0300 From: Giorgos Keramidas To: Henrik W Lund Message-ID: <20040618145818.GA20561@orion.daedalusnetworks.priv> References: <1e3201c45522$c393f840$dc96eed5@maslak> <40D2D095.1080702@broadpark.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40D2D095.1080702@broadpark.no> cc: Yavuz Ma?lak cc: freebsd-questions@freebsd.org Subject: Re: copy or listing problem X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2004 14:53:47 -0000 On 2004-06-18 13:23, Henrik W Lund 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