From owner-freebsd-questions@FreeBSD.ORG Fri Jun 18 11:24:09 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 33CB116A4CE for ; Fri, 18 Jun 2004 11:24:09 +0000 (GMT) Received: from mail.broadpark.no (mail.broadpark.no [217.13.4.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id AC57243D49 for ; Fri, 18 Jun 2004 11:24:08 +0000 (GMT) (envelope-from henrik.w.lund@broadpark.no) Received: from broadpark.no (52.80-202-129.nextgentel.com [80.202.129.52]) by mail.broadpark.no (Postfix) with ESMTP id CD8C42DD7; Fri, 18 Jun 2004 13:23:25 +0200 (MEST) Message-ID: <40D2D095.1080702@broadpark.no> Date: Fri, 18 Jun 2004 13:23:01 +0200 From: Henrik W Lund User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040410 X-Accept-Language: no, en-us, en MIME-Version: 1.0 To: =?ISO-8859-9?Q?Yavuz_Ma=FElak?= References: <1e3201c45522$c393f840$dc96eed5@maslak> In-Reply-To: <1e3201c45522$c393f840$dc96eed5@maslak> Content-Type: text/plain; charset=ISO-8859-9; format=flowed Content-Transfer-Encoding: 8bit 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 11:24:09 -0000 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. > > Do I have to copy them in pieces ? > > What shall I do ? > > Thanks Greetings! 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] This will only do files, not directories or other special files. If you want to copy directories as well, the script will quickly grow bigger. Read man sh for more (maybe even too much) info on how to do anything with scripts. -Henrik W Lund