<?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: Move all the shape files to Geodatabase using arcpy in ArcMap Questions</title>
    <link>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1117838#M3196</link>
    <description>&lt;P&gt;Are you doing this once or on a regular basis?&lt;/P&gt;&lt;P&gt;If doing it once why not simply use the tool in ArcCatalog to move all the shape files at once.&lt;/P&gt;&lt;P&gt;Or in Catalog, select all the shape files and drag them to your data base&lt;/P&gt;&lt;P&gt;If on a regular basis set it up using Model builder and then export the model to a python script.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Nov 2021 19:23:56 GMT</pubDate>
    <dc:creator>RobertBorchert</dc:creator>
    <dc:date>2021-11-17T19:23:56Z</dc:date>
    <item>
      <title>Move all the shape files to Geodatabase using arcpy</title>
      <link>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1115986#M3183</link>
      <description>&lt;P&gt;&lt;A href="https://www.unionwells.com" target="_self"&gt;I&lt;/A&gt; want to move all my shape files to the geodatabase, with a single command, means I don’t want to manually copy one by one shape file into the geodatabase.&lt;/P&gt;&lt;P&gt;Below is the code I am using, but unable to copy my data from shape file to the geodatabase.&lt;/P&gt;&lt;PRE&gt;import arcpy
arcpy.env.workspace = "d:/roads_shp"
fcs = arcpy.ListFeatureClasses("*")

arcpy.env.workspace = "Database Connections/Bluestar.sde"

for fc in fcs: 
    arcpy.CopyFeatures_management(fc)&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Nov 2021 11:03:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1115986#M3183</guid>
      <dc:creator>AsimRaza</dc:creator>
      <dc:date>2021-11-11T11:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Move all the shape files to Geodatabase using arcpy</title>
      <link>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1116064#M3184</link>
      <description>&lt;P&gt;Are you getting any errors?&amp;nbsp; Are there any other files in d:/roads_shp?&lt;/P&gt;&lt;P&gt;Here is some python I whipped up that works for me.&amp;nbsp; There may be other approaches using walk() and or glob() ; I don't like to over complicate things:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy,os

shapeDir = r'C:\Temp\my_shapes'
arcpy.env.workspace = shapeDir
targetGDB = r'C:\Temp\TargetGeodatase.gdb'
shapeFileList=[]
for file in os.listdir(shapeDir):
    if file.endswith(".shp"):
        shapeFileList.append(file)
        
for shapeFile in shapeFileList:
    newName = shapeFile.split('.')[0]
    arcpy.conversion.FeatureClassToFeatureClass(shapeFile,targetGDB,newName)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pretty straight forward; get a list of shapefiles and step through it.&amp;nbsp; Use the 'root' name of the shapefile for your geodatabase feature class and let it rip.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoeBorgione_0-1636651800216.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/27231i0FC869C82AA7CAB8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JoeBorgione_0-1636651800216.png" alt="JoeBorgione_0-1636651800216.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoeBorgione_1-1636651838974.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/27232i814A027CF0CCD333/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JoeBorgione_1-1636651838974.png" alt="JoeBorgione_1-1636651838974.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 17:31:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1116064#M3184</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-11-11T17:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Move all the shape files to Geodatabase using arcpy</title>
      <link>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1116990#M3192</link>
      <description>&lt;P&gt;CopyFeatures_management&amp;nbsp;requires two parameters - where are you copy&lt;A href="https://www.all-for-skin-beauty.com" target="_self"&gt;i&lt;/A&gt;ng it to?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 18:56:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1116990#M3192</guid>
      <dc:creator>ArhamKhan908</dc:creator>
      <dc:date>2021-11-15T18:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: Move all the shape files to Geodatabase using arcpy</title>
      <link>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1117838#M3196</link>
      <description>&lt;P&gt;Are you doing this once or on a regular basis?&lt;/P&gt;&lt;P&gt;If doing it once why not simply use the tool in ArcCatalog to move all the shape files at once.&lt;/P&gt;&lt;P&gt;Or in Catalog, select all the shape files and drag them to your data base&lt;/P&gt;&lt;P&gt;If on a regular basis set it up using Model builder and then export the model to a python script.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Nov 2021 19:23:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1117838#M3196</guid>
      <dc:creator>RobertBorchert</dc:creator>
      <dc:date>2021-11-17T19:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Move all the shape files to Geodatabase using arcpy</title>
      <link>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1136782#M3356</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;Moving new one to the gdb is easy&lt;A href="https://bit.ly/3IG3xgR" target="_self"&gt;.&lt;/A&gt; Original ones I think is pretty straight forward. I can write some code later if you want. Files in TOC are not in the 'air' you can check their source in properties. With that info we can work out something out.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 08:22:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1136782#M3356</guid>
      <dc:creator>KanwalAftab</dc:creator>
      <dc:date>2022-01-25T08:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Move all the shape files to Geodatabase using arcpy</title>
      <link>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1136789#M3357</link>
      <description>&lt;P&gt;I am not an expert in Python but perhaps you can help to understand what is that you are exactly trying to achieve here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you trying to bring multiple shapefiles into a single feature class or you want one feature class for each shapefile?&lt;/P&gt;&lt;P&gt;If you wish to do perform the latter then you are better off using the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/conversion/feature-class-to-geodatabase.htm" target="_self"&gt;Feature Class to Geodatabase&lt;/A&gt;&amp;nbsp;tool. This tool is basically designed to work on batches of data that need to be migrated into a geodatabase.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you open the link you should be able to see the Python snippet for the same.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 09:05:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1136789#M3357</guid>
      <dc:creator>shan_sarkar</dc:creator>
      <dc:date>2022-01-25T09:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Move all the shape files to Geodatabase using arcpy</title>
      <link>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1250430#M4264</link>
      <description>&lt;P&gt;Thanks for posting that! You just helped me cut my script down from about 90 lines haha.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 16:23:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/move-all-the-shape-files-to-geodatabase-using/m-p/1250430#M4264</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-01-23T16:23:25Z</dc:date>
    </item>
  </channel>
</rss>

