I want to test:
I was thinking something like:
rootDir = "\homePath"featureinput1 = "path"newOnlyShpList = []for dirPath, dirNames, fileNames in os.walk(rootDir): for file in fileNames: if fnmatch.fnmatch(file, "*" + "2012" + "*" + ".shp")== True ##AND IF ONE SHAPEFILE EXISTS BY ITSELF IN DIRECTORY:## ##append to newOnlyShpList arcpy.Merge_managment([featureinput1, newOnlyShpList], "OutputHere") elif ##ignore if greater than one shapefileAll I know about is the arcpy .exists function but all that does is return a boolean on whether any shapefile exists. Maybe I need to check just for 1 .shp extension and it has nothing to do with arcpy?
أكثر...
- to see whether or not ONE AND ONLY ONE shapefile (which will be based on a filename wildcard) exists in a directory.
- Add these shapefiles to a list
- Use this list variable as an input to merge_managment function.
I was thinking something like:
rootDir = "\homePath"featureinput1 = "path"newOnlyShpList = []for dirPath, dirNames, fileNames in os.walk(rootDir): for file in fileNames: if fnmatch.fnmatch(file, "*" + "2012" + "*" + ".shp")== True ##AND IF ONE SHAPEFILE EXISTS BY ITSELF IN DIRECTORY:## ##append to newOnlyShpList arcpy.Merge_managment([featureinput1, newOnlyShpList], "OutputHere") elif ##ignore if greater than one shapefileAll I know about is the arcpy .exists function but all that does is return a boolean on whether any shapefile exists. Maybe I need to check just for 1 .shp extension and it has nothing to do with arcpy?
أكثر...