Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!dsl.pitt.edu!pitt!darth!investor!rbp From: rbp@investor.pgh.pa.us (Bob Peirce #305) Newsgroups: comp.unix.wizards Subject: Re: Copying Multiple Files Message-ID: <1990May25.113538.11790@investor.pgh.pa.us> Date: 25 May 90 11:35:38 GMT References: <23368@adm.BRL.MIL> <16512@phoenix.Princeton.EDU> <207@taumetCOM> <1990May21.011549.8072@athena.mit.edu> Reply-To: rbp@investor.pgh.pa.us (Bob Peirce #305) Organization: Cookson, Peirce & Co., Pittsburgh, PA Lines: 32 In article <1990May21.011549.8072@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: >In article <207@taumetCOM>, steve@taumetCOM (Stephen Clamage) writes: >|> I don't get it. Why not just: >|> >|> cp source_directory/foo.* target_directory >|> >|> Does your script do something the obvious command doesn't do? > > This does not do what the original poster asked. The poster asked: if >she has a bunch of filenames with the same basename, e.g. foo.a, foo.b, >foo.c, foo.d, etc., how would she go about renaming them all to bar.a, >bar.b, bar.c, bar.d, etc. > Here is a start to getting there. Somebody posted a rename script a while back that does suffixes; eg, rename *.foo to *.bar. I suspect it could be modified to do the above. Here is the script -- #!/bin/csh # script to change suffixes enmasse if ( $#argv != 2 ) then echo "usage: rename from to" exit endif foreach i ( *.$argv[1] ) mv $i $i:r.$argv[2] end -- Bob Peirce, Pittsburgh, PA 412-471-5320 ...!uunet!pitt!investor!rbp rbp@investor.pgh.pa.us