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 Doering         |  EscapeBox - Managed On-Demand UNIX Servers
[EMAIL PROTECTED]  |  http://www.escapebox.net
[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to