Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.unix.wizards Subject: Re: Copying Multiple Files Message-ID: <8210@jpl-devvax.JPL.NASA.GOV> Date: 26 May 90 04:05:37 GMT References: <23368@adm.BRL.MIL> <16512@phoenix.Princeton.EDU> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Followup-To: comp.unix.questions Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 28 In article <16512@phoenix.Princeton.EDU> pfalstad@phoenix.Princeton.EDU (Paul John Falstad) writes: : In article <23368@adm.BRL.MIL> rose@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@jpl-devvax.jpl.nasa.gov