Batch DEM -> GRID AML for ArcGRID

When you get many small tiles of data from sources like
http://data.geocomm.com/catalog/index.html

(a source of 1:24,000 DEMs for the contiguous US states)

You often need to batch convert these files to a native ESRI format.

Here's an AML to run at the GRID command to convert all DEM files in the folder to GRID

---
&setvar filelist := [listfile *.dem -file]
&if [null %filelist%] &then
&return Cannot find any dem files.
&setvar totalnum := [token %filelist% -count]
&do I := 1 &to %totalnum%
&type Converting image to grid for [extract %i% %filelist%]
[substr [extract %i% %filelist%] 1 7] = DEMGRID ( [extract %i% %filelist%] )
&end
&return
---
Instructions:
Paste the above into a text file called DEM2GRID.aml
Put in same directory as .dem files.
start GRID. Type &wo and your path, then call AML

Like this
&wo c:\gis_data\DEM\
&run DEM2GRID.aml

***
If you're starting from SDTS, such as SDTS (DDF) -> DEM -> GRID you may have to use a converter program. Get SDTS2DEM from

http://www.cs.arizona.edu/topovista/sdts2dem/


IMAGE to GRID

this can often be used for BIL files

IMAGE2GRID.aml
---
&setvar filelist := [listfile *.tif -file]
&if [null %filelist%] &then
&return Cannot find any tif files.
&setvar totalnum := [token %filelist% -count]
&do I := 1 &to %totalnum%
&type Converting image to grid for [extract %i% %filelist%]
IMAGEGRID [extract %i% %filelist%] [substr [extract %i% %filelist%] 1 7]
&end
&return
---

You may need to write image file name without the .TIF part