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

Re: Unix command(s) to eliminate file extension?

On Fri, May 12, 2006 at 11:12:57AM +0200, Rodolfo Medina wrote:
> Hi.
> Suppose I have in a directory a certain number of files,
> all terminating with `.txt', and that I want to eliminate
> that suffix from all of them.
> Is there a Unix command, or perhaps a set of commands,
> that can do so?

If I correctly understand  what you want to do, a simple
minded way of doing it using two commands and a shell
loop would be:
	for i in *.txt ;do
	mv $i `basename $i .txt`

Digby R. S. Tarvin                                          digbyt(at)digbyt.com

Reply to: