Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!iuvax!pur-ee!uiucdcs!uiucdcsm!liberte From: liberte@uiucdcsm.cs.uiuc.edu Newsgroups: comp.sources.d Subject: Re: Looking for "rename" program source Message-ID: <6900004@uiucdcsm> Date: 30 May 88 00:36:00 GMT References: <10910@cgl.ucsf.EDU> Lines: 27 Nf-ID: #R:cgl.ucsf.EDU:10910:uiucdcsm:6900004:000:469 Nf-From: uiucdcsm.cs.uiuc.edu!liberte May 29 19:36:00 1988 Here is my rename script. Dan LaLiberte liberte@a.cs.uiuc.edu uiucdcs!liberte --- #! /bin/csh -f # rename files with a sed command. File names may have spaces in them. if ($#argv < 2) then echo "Usage: rename sed-command file ..." exit (1) endif set command = "$1" shift set noglob while ($#argv > 0) set name = ($argv[1]) shift set newname = `echo "$name" | sed -e "$command"` if ($status != 0) exit 1 echo "mv $name $newname" mv "$name" "$newname" end