[FWTools] batch gdal_translate ??

Mateusz Loskot mateusz at loskot.net
Wed Jul 30 12:36:28 EDT 2008


Garret Wais wrote:
> Hello,
> I would like to create a bat file for gdal_translate.  I have about one
> thousand sid files that I would like to convert to jpg, I know I can
> use, "gdal_translate -of JPEG FILENAME.sid OUTPUT.jpg" to do this but
> doing that 1000 X's would not be efficient (or fun). 
> I know there is a way to write something like:
> 
> for file in *
> do input=`echo $file
> etc etc.
> 
> I just cant remember exactly how it should be written.  If anyone can
> help that would be great.

Garret,

Something like this:

for file in *.sid
do
   gdal_translate -f JPEG $f.sid $f_out.jpg
done

This should help as well:

http://tldp.org/LDP/abs/html/loops1.html


Regards
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org


More information about the FWTools mailing list