<?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 Rename feature class using arcpy python in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/rename-feature-class-using-arcpy-python/m-p/12674#M658</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;There are multiple FileGDB in a folder. Each of these FIleGDB contain multiple feature classes. I want rename the feature class name in such a way that the name of respective FileGDB is added to its name&lt;/P&gt;&lt;P&gt;For instance&lt;/P&gt;&lt;P&gt;FileGDB name is &lt;STRONG&gt;Bus.gdb&lt;/STRONG&gt;. Feature classes with in this gdb are &lt;STRONG&gt;Stops&lt;/STRONG&gt; and &lt;STRONG&gt;Routes&lt;/STRONG&gt;. I want to rename these feature classes as &lt;STRONG&gt;Bus_Stops&lt;/STRONG&gt; and &lt;STRONG&gt;Bus_Routes&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Ii would like to use arcpy to achieve this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Sep 2019 12:39:25 GMT</pubDate>
    <dc:creator>AnandRao</dc:creator>
    <dc:date>2019-09-09T12:39:25Z</dc:date>
    <item>
      <title>Rename feature class using arcpy python</title>
      <link>https://community.esri.com/t5/data-management-questions/rename-feature-class-using-arcpy-python/m-p/12674#M658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;There are multiple FileGDB in a folder. Each of these FIleGDB contain multiple feature classes. I want rename the feature class name in such a way that the name of respective FileGDB is added to its name&lt;/P&gt;&lt;P&gt;For instance&lt;/P&gt;&lt;P&gt;FileGDB name is &lt;STRONG&gt;Bus.gdb&lt;/STRONG&gt;. Feature classes with in this gdb are &lt;STRONG&gt;Stops&lt;/STRONG&gt; and &lt;STRONG&gt;Routes&lt;/STRONG&gt;. I want to rename these feature classes as &lt;STRONG&gt;Bus_Stops&lt;/STRONG&gt; and &lt;STRONG&gt;Bus_Routes&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Ii would like to use arcpy to achieve this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2019 12:39:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/rename-feature-class-using-arcpy-python/m-p/12674#M658</guid>
      <dc:creator>AnandRao</dc:creator>
      <dc:date>2019-09-09T12:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: Rename feature class using arcpy python</title>
      <link>https://community.esri.com/t5/data-management-questions/rename-feature-class-using-arcpy-python/m-p/12675#M659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is normally done&amp;nbsp; with&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/rename.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/rename.htm"&gt;Rename—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will need to list your featureclasses and parse on the required gdb name to each one.&lt;/P&gt;&lt;P&gt;The code example shows the basic syntax for one&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2019 13:02:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/rename-feature-class-using-arcpy-python/m-p/12675#M659</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-09-09T13:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename feature class using arcpy python</title>
      <link>https://community.esri.com/t5/data-management-questions/rename-feature-class-using-arcpy-python/m-p/12676#M660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe you can try this, you have to change the path:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

top_folder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"your path"&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; path&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; dirs&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; files &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;walk&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;top_folder&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; d &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; dirs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; d&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;endswith&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;".gdb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;continue&lt;/SPAN&gt;
        gdb_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; d&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        
        arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gdb_path
        
        featureclasses &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFeatureClasses&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        
        &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; featureclasses&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
      
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Rename_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{}_{}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;d&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:32:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/rename-feature-class-using-arcpy-python/m-p/12676#M660</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2021-12-10T20:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename feature class using arcpy python</title>
      <link>https://community.esri.com/t5/data-management-questions/rename-feature-class-using-arcpy-python/m-p/12677#M661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Johannes for your reply.It is&amp;nbsp;helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually,I tried the below code and was able to get the expected results&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;arcpy.env.workspace = r"my_workspace"&lt;BR /&gt;wks = arcpy.ListWorkspaces('*','FileGDB') &lt;BR /&gt;for fgdb in wks:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; arcpy.env.workspace = fgdb&lt;BR /&gt;&amp;nbsp; &amp;nbsp; fClasses = arcpy.ListFeatureClasses('*','','Placemarks')&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for fc in fClasses:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; arcpy.Rename_management(fc,fgdb.split('.')[0]+"_"+fc ,'')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2019 06:15:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/rename-feature-class-using-arcpy-python/m-p/12677#M661</guid>
      <dc:creator>AnandRao</dc:creator>
      <dc:date>2019-09-11T06:15:42Z</dc:date>
    </item>
  </channel>
</rss>

