Path: utzoo!mnetor!uunet!husc6!bloom-beacon!gatech!ncar!noao!arizona!naucse!rrr
From: rrr@naucse.UUCP (Bob Rose )
Newsgroups: comp.unix.questions
Subject: Re: Need a file renaming facility
Message-ID: <686@naucse.UUCP>
Date: 9 May 88 17:18:42 GMT
References: <13840@brl-adm.ARPA>
Organization: Northern Arizona University, Flagstaff, AZ
Lines: 32
Summary: We can do better

Amos Shapira writes:
> Chris Reimer writes:
> >Gary Benson writes:
> >>    QT.1.r       QT.4.r           QT.A.r
> >>    Qt.1.r.pre       QT.4.r.pre           QT.A.r.pre
> >>Now I want to rename all those ".pre" files to the same name without ".pre".
> >    foo% foreach i ( `ls *.pre  sed 's/.pre$//'` )
> >    ? echo "Moving ${i}..."
> >    ? mv ${i}.pre $i
> >    ? end
> 
>       Could make it simpler, and much more importnt, faster.
>     % foreach i (*.pre)
>     ? echo Moving $i...
>     ? mv $i `basename $i .pre`
>     ? end

So we want to make this one time command run faster, then why
are we running `basename' for each arguement. Lets use the real
power of the csh.

	% foreach i (*.pre)
	? echo Moving $i...
	? mv $i $i:r
	? end

This may also be to slow also. Has anybody modified `mv' to move files
to their basename. Something like

	% mv -b *.pre

:^) 8^) :`) O^) ;^) |^) :~) :^} :^] &^) %^) :^{) X^) (Hopefully thats enough)