Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 May 2004 10:35:51 -0700
From:      Drew Tomlinson <drew@mykitchentable.net>
To:        Mike Hogsett <hogsett@csl.sri.com>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: How To Copy A Group of Files To Different Name?
Message-ID:  <40AA4977.9020304@mykitchentable.net>
In-Reply-To: <200405181725.i4IHPXtT016748@beast.csl.sri.com>
References:  <200405181725.i4IHPXtT016748@beast.csl.sri.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5/18/2004 10:25 AM Mike Hogsett 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.
>>
>
>
>Well it may not be right, but there is more than one way to skin a cat.
>
>
>if using bash as your shell you could do 
>
>> <>for b in *
>> do
>> mv $b ${b}.old
>> done
>>
OK, thanks.  I'm using tcsh but I think I figure out how to do it 
following your example.  So a "script" is the only way to do it in 
*nix?  Being born and raised on MS-DOS, I'm accustomed to the "copy bac* 
bac*.old" syntax.

Thanks,

Drew

-- 
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books, & More!

http://www.alchemistswarehouse.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40AA4977.9020304>