import arcgisscripting, string, os, sys gp = arcgisscripting.create(9.3) gp.Workspace = r"U:\GIS\Temp" ascList = gp.ListRasters("*.asc", "*") for ascFile in ascList: dsc = gp.Describe(ascFile) # Gets the Description about the ascii file ascIn = dsc.CatalogPath # Gets the Full Catalog Path of the ascii file ascOut = ascIn[:-4] + ".img" # Removes the .asc extension and adds .img gp.ASCIIToRaster_conversion(ascIn, ascOut, "FLOAT")
ArcGIS doesn't see .asc files as files, they are recognized as raster datasets. arcpy.ListRasters() would have worked in this case.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.