<?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: How to merge hundreds of shapefiles into one gdb  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716195#M55537</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/289718"&gt;Andrew,&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please take a look at &lt;A href="https://community.esri.com/migrated-users/42743"&gt;Ian Murray&lt;/A&gt; post in &lt;A _jive_internal="true" href="https://community.esri.com/thread/165205"&gt;Python Script to Merge Files&lt;/A&gt;.&amp;nbsp; This would need to be modified to check for "bpoly" in the filename.&amp;nbsp; Another python sample source is &lt;A href="http://gistricks.com/blog/batch-merge-arcgis/"&gt;Batch merge ArcGIS&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jul 2019 02:07:50 GMT</pubDate>
    <dc:creator>LanceCole</dc:creator>
    <dc:date>2019-07-10T02:07:50Z</dc:date>
    <item>
      <title>How to merge hundreds of shapefiles into one gdb</title>
      <link>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716194#M55536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to merge a couple hundred shapefiles into one gdb, however, I only want to select shapefiles that contain "bpoly" in the name (as I will repeat for shapefiles that only contain other names with common expressions). When trying to do this manually, the merge tool has not been capable of running with up to 200 shapefiles.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not used python script before but believe this will be the solution, if anyone has an idea of how to go about it that would be great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2019 01:50:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716194#M55536</guid>
      <dc:creator>DarcyKenyon1</dc:creator>
      <dc:date>2019-07-10T01:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge hundreds of shapefiles into one gdb</title>
      <link>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716195#M55537</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/289718"&gt;Andrew,&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please take a look at &lt;A href="https://community.esri.com/migrated-users/42743"&gt;Ian Murray&lt;/A&gt; post in &lt;A _jive_internal="true" href="https://community.esri.com/thread/165205"&gt;Python Script to Merge Files&lt;/A&gt;.&amp;nbsp; This would need to be modified to check for "bpoly" in the filename.&amp;nbsp; Another python sample source is &lt;A href="http://gistricks.com/blog/batch-merge-arcgis/"&gt;Batch merge ArcGIS&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2019 02:07:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716195#M55537</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2019-07-10T02:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge hundreds of shapefiles into one gdb</title>
      <link>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716196#M55538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Lance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I have never used python before I am unsure of what inputs I need to add to change the script to suit my needs. I am having trouble finding tutorials for python in arc or a directory to understand the terms used in the script. Do you have any other useful links that may help me?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2019 02:49:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716196#M55538</guid>
      <dc:creator>DarcyKenyon1</dc:creator>
      <dc:date>2019-07-10T02:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge hundreds of shapefiles into one gdb</title>
      <link>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716197#M55539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;#Importing Modules  &lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy  
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os  
&lt;SPAN class="comment token"&gt;#Setting root workspace where files are located  &lt;/SPAN&gt;
workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"FilePath"&lt;/SPAN&gt;  
&lt;SPAN class="comment token"&gt;#Making an empty list to put filepaths to feature classes in  &lt;/SPAN&gt;
feature_classes &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;  
&lt;SPAN class="comment token"&gt;#Walking workspace recursively checking type, and appending filepath to list  &lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; dirpath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; dirnames&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; filenames &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Walk&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;datatype&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FeatureClass"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; type&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Polygon"&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;for&lt;/SPAN&gt; filename &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; filenames&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;  
        desc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Describe&lt;SPAN class="punctuation 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;dirpath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;  
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; desc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;shapeType &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Polygon"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;  
            feature_classes&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation 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;dirpath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;  
            
&lt;SPAN class="comment token"&gt;#merging my list of feature classes to a new dataset  &lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Merge_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature_classes&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\Path\MergedPolygons"&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Line 5... the path to the folder containing the shapefiles eg&amp;nbsp; r"C:\GIS\Data"&lt;/P&gt;&lt;P&gt;Line 9.... change 'type' to either Polygon, Polyline, Point as appropriate.... you can't merge different geometry types.&lt;/P&gt;&lt;P&gt;Line 16... change the "C:\Path\Merged\Polygons" to&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; r"C:\PathToYour\Geodatabase.gdb\MergedPolygons"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check&amp;nbsp;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/merge.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/merge.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Merge—Data Management toolbox | ArcGIS Desktop&lt;/A&gt; for exact syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course the whole thing about field mapping has been left out, so if you fields aren't identical... doing it manually may be faster &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:40:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716197#M55539</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T06:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge hundreds of shapefiles into one gdb</title>
      <link>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716198#M55540</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/289718"&gt;Andrew Becker&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Use Google and search for "youtube getting started with python" this will give you a basic understanding of the language and how to use the command line interface.&amp;nbsp; Once you have experimented with the basics try searching for ArcGIS python to get more examples specific to GIS. &lt;A href="https://www.esri.com/videos"&gt;E360&lt;/A&gt; is another great source for python videos specific to ESRI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) You will need some type of text editor.&amp;nbsp; You can use Notepad but this will not have python syntax highlighting.&amp;nbsp; As you have ArcGIS installed you will also have IDLE on your system that does support syntax highlighting.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) Jump in with both feet, take the code sample from &lt;A _jive_internal="true" data-containerid="2046" data-containertype="14" data-objectid="165205" data-objecttype="1" href="https://community.esri.com/thread/165205"&gt;Python Script to Merge Files&lt;/A&gt;, put a couple of shapefiles and a GDB in a test directory (do not try to run this on your entire set of data from the start), start to make the changes as &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt; noted above, see what happens and work through the issues that arise.&amp;nbsp; It is like a lottery, you are guaranteed not to win if you do not but a ticket.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) If you need help with a specific issue,&amp;nbsp; post a new question and guaranteed someone on GeoNet will lend a hand.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2019 12:38:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-merge-hundreds-of-shapefiles-into-one-gdb/m-p/716198#M55540</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2019-07-10T12:38:16Z</dc:date>
    </item>
  </channel>
</rss>

