From owner-freebsd-questions@FreeBSD.ORG Tue May 18 14:16:45 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 3935016A4CE for ; Tue, 18 May 2004 14:16:45 -0700 (PDT) Received: from gen129.n001.c02.escapebox.net (gen129.n001.c02.escapebox.net [213.73.91.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id 697B8440A6 for ; Tue, 18 May 2004 13:33:44 -0700 (PDT) (envelope-from gemini@geminix.org) Message-ID: <40AA4D6A.5020700@geminix.org> Date: Tue, 18 May 2004 19:52:42 +0200 From: Uwe Doering Organization: Private UNIX Site User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040119 X-Accept-Language: en-us, en MIME-Version: 1.0 To: FreeBSD Questions References: <40AA4621.3000605@mykitchentable.net> In-Reply-To: <40AA4621.3000605@mykitchentable.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Received: from gemini by geminix.org with asmtp (TLSv1:AES256-SHA:256) (Exim 3.36 #1) id 1BQ8lg-000O0m-00; Tue, 18 May 2004 22:29:54 +0200 Subject: Re: How To Copy A Group of Files To Different Name? 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: Tue, 18 May 2004 21:16:45 -0000 Drew Tomlinson wrote: > How can I copy a group of files to a different name. I want to copy all > files starting with 'bacula*' to 'bacula*.old'. So I have these four > files: > > blacklamb# ll bac* > -r--r--r-- 1 root wheel 949 Apr 22 09:13 bacula-barcodes > -rw-r----- 1 root wheel 5792 May 17 16:52 bacula-dir.conf > -rw-r----- 1 root wheel 763 Apr 22 09:13 bacula-fd.conf > -rw-r----- 1 root wheel 1909 May 17 16:31 bacula-sd.conf > > I want to have copies of these files with '.old' appended to their > names. I've tried 'cp -pv bac* bac*.old' but cp complains. Because > it's only 4 files, I'll do each one independently but I'd like to know > how to do this "right" for future reference. You may want to take a look at the utility 'mmv' in the ports tree ('ports/misc/mmv' in CVS). For copying you would use the 'mcp' variant: mcp -v 'bacula*' 'bacula=1.old' It automatically preserves permissions and modification time. For a test run in order to verify in advance what would happen, use the '-n' option. Great tool IMHO. Uwe -- Uwe Doering | EscapeBox - Managed On-Demand UNIX Servers gemini@geminix.org | http://www.escapebox.net