AnsweredAssumed Answered

Feature class name wildcard

Question asked by CCweedcontrol on Dec 21, 2017
Latest reply on Dec 28, 2017 by CCweedcontrol

I have a feature class table that i need to export to excel, the feature class will be created weekly. The problem i am having is that on creation the feature class gets the date added to the end of the feature class name and i am trying to access with a wildcard because the date will change based on when the feature class gets created. How can i get the feature class with a wildcard?


import arcpy  

workspace = "Database Servers\GIS.gds\GISSERVER1 (VERSION:dbo.DEFAULT)"
arcpy.env.workspace = workspace

lyrs = ['Hyrdo_FINAL_ALL_*'] 
for fc in arcpy.ListFeatureClasses(): 
    for lyr in lyrs: 
        if fc.startswith(lyr):
            print 'lyr'

lyr = "Hyrdo_FINAL_ALL_*" #Database Servers\GIS.gds\GISSERVER1 (VERSION:dbo.DEFAULT)\Hyrdo_FINAL_ALL_121817
arcpy.MakeFeatureLayer_management(lyr, "In_memory\lyr1")

arcpy.TableSelect_analysis("In_memory\lyr1","C:/Temp/Export_Output.xls", "")

print 'done'