folderPath = r"C:\your mxd location" # Loop through each folder in the directory to find files containing the extension ".mxd", open each one and process for filename in glob.glob(os.path.join(folderPath, "*.mxd")): fullpath = os.path.join(folderPath, filename) mxd = arcpy.mapping.MapDocument(filename) if os.path.isfile(fullpath): basename, filename2 = os.path.split(fullpath) # At this point, "mxd" is now the variable containing your map document, use that to process whatever it is you're looking to process within each map....
import os, arcpy # Input Folder inputFolder = r"yourfolderpath" # Output Folder outputFolder = r"youroutfolderpath" for inputFilename in os.listdir(inputFolder) : if inputFilename.endswith('.shp') : inputPath = os.path.join(inputFolder, inputFilename) outputPath = os.path.join(outputFolder, inputFilename) gp.Clip_analysis(ENTER PARAMETERS) print "End of processing."
import os, arcpy from arcpy import env # Input Folder inputFolder = r"yourfolderpath" env.workspace = inputFolder # Output Folder outputFolder = r"youroutfolderpath" rasterList = arcpy.ListRasters("", "GRID") for raster in rasterList: inputPath = os.path.join(inputFolder, raster) outputPath = os.path.join(outputFolder, raster) print "End of processing."
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.