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?
<SPAN class="keyword token">import</SPAN> arcpy
workspace <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Database Servers\GIS.gds\GISSERVER1 (VERSION:dbo.DEFAULT)"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> workspace
<SPAN class="string token">'''
lyrs = ['Hyrdo_FINAL_ALL_*']
for fc in arcpy.ListFeatureClasses():
for lyr in lyrs:
if fc.startswith(lyr):
print 'lyr'
'''</SPAN>
lyr <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Hyrdo_FINAL_ALL_*"</SPAN> <SPAN class="comment token">#Database Servers\GIS.gds\GISSERVER1 (VERSION:dbo.DEFAULT)\Hyrdo_FINAL_ALL_121817</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>lyr<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"In_memory\lyr1"</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>TableSelect_analysis<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"In_memory\lyr1"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"C:/Temp/Export_Output.xls"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">'done'</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>