<?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: Shapefile name to Field Name in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357579#M20484</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the replies on this.&amp;nbsp; I did find it way easier to just add the field FILE_NAME to the shapefile attributes, then merge the schema I needed with the shapefile to create a new .gdb file, then just used field calculator to get rid of NULLs and move the file names over.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Aug 2020 17:54:18 GMT</pubDate>
    <dc:creator>JamesWhite5</dc:creator>
    <dc:date>2020-08-04T17:54:18Z</dc:date>
    <item>
      <title>Shapefile name to Field Name</title>
      <link>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357575#M20480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good afternoon.&amp;nbsp; I am trying to figure out how to write a script in Python with extremely little experience.&amp;nbsp; I have been pouring through forums here and at Stack Exchange, but everything seems to be a little out of date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have ~200 shapefiles that I merged into a single featureclass within a geodatabase. I am using a schema that has the field "NAME" in it. I am trying to take the name of the individual shapefiles (x27y407.shp for example) and write that name, minus the .shp, into the NAME field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most of the code I am finding to try and work with seems like it is using python 9 or earlier, so am having a hard time trying to piece it together.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2020 16:09:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357575#M20480</guid>
      <dc:creator>JamesWhite5</dc:creator>
      <dc:date>2020-08-04T16:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Shapefile name to Field Name</title>
      <link>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357576#M20481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You've already done the merge?&amp;nbsp; Not sure how you can recoup the origin name after the fact.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you using Python and Arcpy? If so you could try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a list of all the shapefiles in a given directory:&amp;nbsp;&lt;A class="link-titled" href="https://www.tutorialspoint.com/python/os_listdir.htm" title="https://www.tutorialspoint.com/python/os_listdir.htm"&gt;Python os.listdir() Method - Tutorialspoint&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step through that list and for each shapeFile.shp, 'slice' the name out of it:&amp;nbsp;&lt;A class="link-titled" href="https://www.tutorialspoint.com/python/string_split.htm" title="https://www.tutorialspoint.com/python/string_split.htm"&gt;Python String split() Method - Tutorialspoint&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Join the name back to a string:&amp;nbsp;&lt;A class="link-titled" href="https://www.tutorialspoint.com/python/string_join.htm" title="https://www.tutorialspoint.com/python/string_join.htm"&gt;Python String join() Method - Tutorialspoint&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And finally use arcpy to calculate the value of the field in question to that string:&amp;nbsp;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm"&gt;Calculate Field (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2020 16:53:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357576#M20481</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-08-04T16:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Shapefile name to Field Name</title>
      <link>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357577#M20482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. I will look into that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And yes, I think I did the merge too quick.&amp;nbsp; I think I need to create the NAME field, then merge, and then I can just use the field calculator to populate the NAME field I really need populated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2020 16:59:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357577#M20482</guid>
      <dc:creator>JamesWhite5</dc:creator>
      <dc:date>2020-08-04T16:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: Shapefile name to Field Name</title>
      <link>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357578#M20483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'll want to be sure to update name field before you merge.&amp;nbsp; Once you get going on this, post up any questions you have as you go along...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2020 17:15:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357578#M20483</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-08-04T17:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Shapefile name to Field Name</title>
      <link>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357579#M20484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the replies on this.&amp;nbsp; I did find it way easier to just add the field FILE_NAME to the shapefile attributes, then merge the schema I needed with the shapefile to create a new .gdb file, then just used field calculator to get rid of NULLs and move the file names over.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2020 17:54:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357579#M20484</guid>
      <dc:creator>JamesWhite5</dc:creator>
      <dc:date>2020-08-04T17:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Shapefile name to Field Name</title>
      <link>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357580#M20485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It appears you have resolved your issue. If so, please mark an answer correct to close out this question.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2020 15:08:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357580#M20485</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-08-05T15:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Shapefile name to Field Name</title>
      <link>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357581#M20486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/292537"&gt;James White&lt;/A&gt;‌, I unmarked your answer and gave the correct answer to Joe, since it was his comments that sent you down the right path.&amp;nbsp; Typically, the "Correct" answer is the one that gave you the knowledge to solve the issue, that might be code itself or higher-level information like, "update name field before you merge."&amp;nbsp; It is helpful for the OP to post their final solution/workflow, but that final reply from the OP typically isn't the "Correct" answer unless there was some substantially new or different information in it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2020 15:51:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357581#M20486</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-08-05T15:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Shapefile name to Field Name</title>
      <link>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357582#M20487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joshua,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok, I will remember that.&amp;nbsp; I didn't realize how that worked, thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2020 15:57:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/shapefile-name-to-field-name/m-p/357582#M20487</guid>
      <dc:creator>JamesWhite5</dc:creator>
      <dc:date>2020-08-05T15:57:25Z</dc:date>
    </item>
  </channel>
</rss>

