On Tue, 18 May 2004, Drew Tomlinson wrote:

> 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.

It has to do with shell globbing.  The bac* parameter is expanded to a
list of all files matching that pattern, then fed to the command.  So if
you type 'cp bac* bac*.old' in a Unix shell and your directory has files
bac1, bac2, bac3, and bac4, what it actually tries to execute is:

cp bac1 bac2 bac3 bac4

Note that bac*.old didn't evaluate to anything: there aren't any files
or directories that match that pattern.  So cp gives an error-- it'll
copy multiple files to a directory, but only if the last parameter is a

There are numerous recipes for doing the batch move-and-rename.  The
O'Reilly Unix Power Tools book (highly recommended) has a script that
pipes the output of ls into sed, generating a bunch of individual mv
commands.  You can do the same thing with find, or Perl, or other

-Warren Block * Rapid City, South Dakota USA
[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to