AnsweredAssumed Answered

Trying to Iterate Through List of Directories

Question asked by jonmulder on Dec 6, 2013
Latest reply on Dec 6, 2013 by jonmulder
I've got some very basic test script that I'm running in IDLE.  Essentially, I will have a list of multiple directories that get inputted through a "arcpy.GetParameterAsText".  In IDLE, I've rem'd that line out and just manually created a folder list containing just two directories.  Then I'm using the line "For CurrentFolder in InFolders:" to loop through the directories.

But IDLE gives me an "invalid syntax" and highlights "CurrentFolder".

Any idea why this isn't working?  Thanks for any help you can provide!

Jon Mulder

import os import arcpy # Overwrite pre-existing files arcpy.env.overwriteOutput = True ##arcpy.env.workspace = r"H:\Documents\GIS\BaseData\Raster\Imagery\39121DOQQs"  ##InFolders = arcpy.GetParameterAsText(0) ##Dest=arcpy.GetParameterAsText(1)  InFolders = ([r"H:\Documents\GIS\BaseData\Raster\Imagery\DOQQs\39121"],[r"H:\Documents\GIS\BaseData\Raster\Imagery\DOQQs\39121"]) print InFolders ClipBoundary = r"H:\Documents\GIS\BaseData\Raster\Imagery\AerialPhotos\1958\ClipShapes\AAX\AAX_ClipBoundary.shp"  For CurrentFolder in InFolders:     print CurrentFolder  print "Done."

Outcomes