The Challenge: To batch convert 1000 rasters in ESRI Grid binary to Geotiff using either using a batch file or Python 2.7 without ArcGIS/Arcpy module.
The Tools: Win7Pro, GDAL 1.9.2 (via OSGeo4W), python 2.6/2.7, 1000 binary ESRI Grid rasters (see image)
File structure:
Single file conversion: (piece of cake)
gdal_translate GRID1 -of GTiff GRID1.tif
Batch Route:
for %i in (*.img) do gdal_translate -of GTiff %i %~SourceFilename.tif
The Problem:
ESRI Grids don't have a file extension and are instead treated as file directories by the operating system. I need to find an alternative way to iterate. My only option it seems is to iterate by directory as (to my knowledge) there is no method (to my knowledge) to read the GRIDs into a variable like using the ArcPy method: rasters = arcpy.listRasters("*", "GRID")
Does anyone have any suggestions about how to modify the (*.img) portion of the code so that the loop will read each GRID directory as a file object so I can iterate using the for loop posted above? Note: I'm also aware that I will need to add the parameter for recursion to the batch file and possibly ignore all directories with the name "info".
I know I could just use arcpy and python to accomplish this task, but I wasn't satisfied with the results on google of how to batch convert ESRI GRIDs with only GDAL and maybe python. I appreciate any and all advice!