GDB convert to shp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import arcpy
import os

def GDBConvertToShp(GDBfolder ,SHPfolder):
for root, dirs, files in os.walk(GDBfolder):
for d in dirs:
path= root+"\\"+d
if path[-4:]==".gdb":
name=path.split(".")[0].split("\\")[-1]
arcpy.env.workspace =path
gdbshp=arcpy.ListFeatureClasses()
for fc in gdbshp:
# the name of the feature in GDB you want to convert to shpfile
if str(fc)=="XXXX":
arcpy.FeatureClassToFeatureClass_conversion(fc, SHPfolder,name+str(fc)+".shp")