Copying Multiple Files
Larry Wall
lwall at jpl-devvax.JPL.NASA.GOV
Sat May 26 14:05:37 AEST 1990
In article <16512 at phoenix.Princeton.EDU> pfalstad at phoenix.Princeton.EDU (Paul John Falstad) writes:
: In article <23368 at adm.BRL.MIL> rose at baby.swmed.utexas.edu (Rose Oguz) writes:
: >The original files have the same root name and different extensions. How
: >can I copy them to files with another root name while keeping the
: >extensions?
:
: There is an easy way, but unfortunately it involves a csh script.
Well, not necessarily. On our system it happens you can just say
copy 's/foo/bar/' foo.*
The copy script is just like the Perl rename script mentioned a while back:
#!/usr/bin/perl
$op = shift;
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
system "cp $was $_" unless $was eq $_;
}
Perlophobes could probably whip one up in some other language. Or more
likely, some unholy combination of languages... :-)
Larry Wall
lwall at jpl-devvax.jpl.nasa.gov
More information about the Comp.unix.wizards
mailing list