On Sun, 2003-03-23 at 17:51, Adam Mercer wrote:
> Hi
> 
> I've got a huge batch of targa images that I need to convert to png, as
> I don't want to convert each image individually I thought about writing
> a small script to do this for me. I thought about something along the
> lines of
> 
> for file in $( find . -name '*.tga' | sort )
> do
>       convert $file $file.png
> done
> 
> but as expected this leaves the .tga extension on the file name, before
> the png extension. How can I remove the .tga extension on the file?
> 

You could do:

-----------------------------------------------------
for file in $( find . -type f -name '*.tga' | sort )
do
    convert $file ${file/%\.tga/\.png}
done
-----------------------------------------------------


Regards,

-- 

Martin Schlemmer
Gentoo Linux Developer, Desktop/System Team Developer
Cape Town, South Africa


Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to