<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Find feature class in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/find-feature-class/m-p/106220#M8202</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;See if this helps.&amp;nbsp; I can't remember exactly where I lifted the original code from.&amp;nbsp; Probably a quick google search is where I started.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

gdb = r'Database Connections\MyDBConnection.sde'
arcpy.env.workspace = gdb
featclsInDatasets = []

for fds in arcpy.ListDatasets('','feature') + ['']:
&amp;nbsp; for fc in arcpy.ListFeatureClasses('*_OLD','',fds):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featclsInDatasets.append(os.path.join(fds, fc))

#list the featclasses in datasets
for fc in featclsInDatasets:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc

#list the featClasses not in datasets
for fcmain in arcpy.ListFeatureClasses('*_OLD'):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print fcmain


&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit: ah... I think this is where I originally found the sample: &lt;/SPAN&gt;&lt;A href="http://gis.stackexchange.com/questions/5893/listing-all-feature-classes-in-file-geodatabase-including-within-feature-datase" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gis.stackexchange.com/questions/5893/listing-all-feature-classes-in-file-geodatabase-including-within-feature-datase&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 06:28:06 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2021-12-11T06:28:06Z</dc:date>
    <item>
      <title>Find feature class</title>
      <link>https://community.esri.com/t5/python-questions/find-feature-class/m-p/106219#M8201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I work on &lt;/SPAN&gt;&lt;STRONG&gt;SDE data bases&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would list all the entities classes ending in "_OLD".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However in my database SDE &lt;/SPAN&gt;&lt;STRONG&gt;I've feature classes and datasets entities.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like the script gives a complete list of feature classes ending in "_OLD".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 03:34:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/find-feature-class/m-p/106219#M8201</guid>
      <dc:creator>PierreWeisse</dc:creator>
      <dc:date>2014-06-04T03:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Find feature class</title>
      <link>https://community.esri.com/t5/python-questions/find-feature-class/m-p/106220#M8202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;See if this helps.&amp;nbsp; I can't remember exactly where I lifted the original code from.&amp;nbsp; Probably a quick google search is where I started.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

gdb = r'Database Connections\MyDBConnection.sde'
arcpy.env.workspace = gdb
featclsInDatasets = []

for fds in arcpy.ListDatasets('','feature') + ['']:
&amp;nbsp; for fc in arcpy.ListFeatureClasses('*_OLD','',fds):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featclsInDatasets.append(os.path.join(fds, fc))

#list the featclasses in datasets
for fc in featclsInDatasets:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc

#list the featClasses not in datasets
for fcmain in arcpy.ListFeatureClasses('*_OLD'):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print fcmain


&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit: ah... I think this is where I originally found the sample: &lt;/SPAN&gt;&lt;A href="http://gis.stackexchange.com/questions/5893/listing-all-feature-classes-in-file-geodatabase-including-within-feature-datase" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gis.stackexchange.com/questions/5893/listing-all-feature-classes-in-file-geodatabase-including-within-feature-datase&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:28:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/find-feature-class/m-p/106220#M8202</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T06:28:06Z</dc:date>
    </item>
  </channel>
</rss>

