Michael C. Toren on Tue, 6 Jul 1999 15:15:43 -0400 (EDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [Plug] quick solution please


> how can one change the extention on a group of files?  I've got a bunch of
> .txt files, and I want to drop the extention... like make text.txt just
> text... for a group... how could I do it all in one command?

Using the Bourne shell, you could do:

   for i in *.txt; do j=`echo $i | cut -d. -f1`; if [ -e $j ]; then echo \
   "File $j exists; couldn't rename $i"; else echo $i; mv $i $j; fi; done

-mct