<?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 Code block to get filepath of shapefile in field calculator in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/code-block-to-get-filepath-of-shapefile-in-field/m-p/652720#M50836</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does anyone know a python codeblock to input the filepath of a shapefile in a field using field calculator?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll be merging a whole lot of shapefiles later and it would be good to keep track of each record in manner. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wil&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Mar 2011 04:14:45 GMT</pubDate>
    <dc:creator>wilfredwaters</dc:creator>
    <dc:date>2011-03-10T04:14:45Z</dc:date>
    <item>
      <title>Code block to get filepath of shapefile in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/code-block-to-get-filepath-of-shapefile-in-field/m-p/652720#M50836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does anyone know a python codeblock to input the filepath of a shapefile in a field using field calculator?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll be merging a whole lot of shapefiles later and it would be good to keep track of each record in manner. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wil&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Mar 2011 04:14:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/code-block-to-get-filepath-of-shapefile-in-field/m-p/652720#M50836</guid>
      <dc:creator>wilfredwaters</dc:creator>
      <dc:date>2011-03-10T04:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Code block to get filepath of shapefile in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/code-block-to-get-filepath-of-shapefile-in-field/m-p/652721#M50837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should be able to calculate this without using a python codeblock. It should be as simple as putting the path to the shapefile in quotes as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r"C:\Path\To\Shapefile.shp"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would think that you'd want to first calculate this on all of your shapefiles prior to running the merge tool. This could be done by doing the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Use the arcpy.da.walk or arcpy.ListFeatureClasses methods to locate the shapefiles on disk.&lt;/P&gt;&lt;P&gt;2. For each shapefile found check to see if it has the field that will be storing the path, if not add this field.&lt;/P&gt;&lt;P&gt;3. In the field calculate pass the path to the feature class surrounded by quotes to persist this information in the field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2015 22:54:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/code-block-to-get-filepath-of-shapefile-in-field/m-p/652721#M50837</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2015-09-16T22:54:37Z</dc:date>
    </item>
  </channel>
</rss>

