<?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 List all Layer Files in a directory which reference a specific Feature Class? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/list-all-layer-files-in-a-directory-which/m-p/260259#M20032</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good morning! We have changed our data to allow temporal tracking, which means that all shared layer files which reference our ROADS feature class require the addition of&amp;nbsp; AND "RECORD_STATUS" = 5 to their definition query.&amp;nbsp; We have a couple hundred layer files in lots of folders; I can't be certain which ones reference this feature class.&amp;nbsp; How can I write a python script to comb through the directory and return all layer files which reference the ROADS feature class?&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Oct 2011 13:50:32 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2011-10-20T13:50:32Z</dc:date>
    <item>
      <title>List all Layer Files in a directory which reference a specific Feature Class?</title>
      <link>https://community.esri.com/t5/python-questions/list-all-layer-files-in-a-directory-which/m-p/260259#M20032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good morning! We have changed our data to allow temporal tracking, which means that all shared layer files which reference our ROADS feature class require the addition of&amp;nbsp; AND "RECORD_STATUS" = 5 to their definition query.&amp;nbsp; We have a couple hundred layer files in lots of folders; I can't be certain which ones reference this feature class.&amp;nbsp; How can I write a python script to comb through the directory and return all layer files which reference the ROADS feature class?&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2011 13:50:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-all-layer-files-in-a-directory-which/m-p/260259#M20032</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-10-20T13:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: List all Layer Files in a directory which reference a specific Feature Class?</title>
      <link>https://community.esri.com/t5/python-questions/list-all-layer-files-in-a-directory-which/m-p/260260#M20033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's certainly functionality to do this.&amp;nbsp; Something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;folderPath = 'C:\temp'
targetDataSource = 'C:\mapping\shapefile.shp'

files = os.listdir(folderPath)
for curFile in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if curFile.endswith(".txt"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in arcpy.mapping.ListLayers(curFile):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.dataSource == targetDataSource:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Outdated layer found at " + lyr.lyr_file_path)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's a little if-happy, but try that angle and see what you get.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:48:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-all-layer-files-in-a-directory-which/m-p/260260#M20033</guid>
      <dc:creator>ChristopherStorer</dc:creator>
      <dc:date>2021-12-11T12:48:15Z</dc:date>
    </item>
  </channel>
</rss>

