AnsweredAssumed Answered

Trying to have the script run on all subfolder

Question asked by Darowski_94 on Jul 10, 2018
Latest reply on Jul 10, 2018 by jborgion

Hi 

 

I'm currently using a script to create contour lines on a large number of DEMs. The DEMs are currently saved to individual folders within my 'DATA' folder. I need the script to run on all the subfolders and have the outputs save to a different folder ('Output" folder). 

 

I know there is a way to loop through all the subfolders but I can't seem to figure it out. I am fairly new scripting and never try to get a script to run on multiple subfolders at a time. Any help would be appreciated.

 

 

Thank you in advance for your help.

 

below is the script that I currently have :

 

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/DATA/ScriptTesting/test"
inRaster = "1km17670"
contourInterval = 5
baseContour = 0
outContours = "C:/DATA/ScriptTesting/test/output/contours5.shp"
arcpy.CheckOutExtension("Spatial")
Contour(inRaster,outContours, contourInterval, baseContour)

Outcomes