# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# mergeSubRegionData.py
# Created on: 2016-07-27 09:10:17.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Set the necessary product code
# import arcinfo
# Import arcpy module
import os
import random
from itertools import groupby
import zipfile
import arcpy
# Check out any necessary licenses
# Set Geoprocessing environments
arcpy.env.overwriteOutput = True
targetDataset = "E:\guangxi\gxsh.gdb\xian"
#layerList = ['AGNP','BOUA','DIKL','HFCL','HFCP','HYDA','JCZD','LRDL','LRRL','MXRV','NODE','RESA','RIVL','RVDM','SKUA','SLTA','USLU','WATA','WATL','WSML','WSRL','WSWA','WSWL','XJ']
#layerList = ['AGNP','BOUA','DIKL','HFCL','HFCP','HYDA','JCZD','LRDL','LRRL','MXRV','NODE','RESA','RIVL','RVDM','SKUA','SLTA','USLU','WATA','WATL','WSML','WSRL','WSWA','WSWL','XJ']
layerList = ['SKUP']
path = "E:\guangxi\output0"
currentFiles = os.listdir(path)
'''
for fileName in currentFiles:
print("-----------------------------------"+fileName+"-----------------------------------")
for layerName in layerList:
shpfileName = path + "\" + fileName + "\"+layerName+".shp"
targetLayer = targetDataset + "\"+layerName
print(targetLayer)
arcpy.Append_management(shpfileName, targetLayer, "TEST","","")
'''
for layerName in layerList:
print("-----------------------------------"+layerName+"-----------------------------------")
for fileName in currentFiles:
shpfileName = path + "\" + fileName + "\"+layerName+".shp"
if not os.path.exists(shpfileName):
continue
targetLayer = targetDataset + "\"+layerName
print(shpfileName)
#arcpy.Append_management(shpfileName, targetLayer, "TEST","","")
arcpy.Append_management(shpfileName, targetLayer, "NO_TEST","","")
print("OK")