Need a file renaming facility
Bob Rose
rrr at naucse.UUCP
Tue May 10 03:18:42 AEST 1988
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)
More information about the Comp.unix.questions
mailing list