<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>The GDAL ogrtindex might be of good help to create an index of
      various vector sources: <a class="moz-txt-link-freetext" href="https://gdal.org/programs/ogrtindex.html">https://gdal.org/programs/ogrtindex.html</a></p>
    <p>And you can possibly "gdalmanage identify -r some_path" to find
      all GDAL recognizable datasets:
      <a class="moz-txt-link-freetext" href="https://gdal.org/programs/gdalmanage.html">https://gdal.org/programs/gdalmanage.html</a></p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 12/05/2024 à 23:41, Tony Shepherd
      (FarmMaps NZ) via QGIS-User a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:000101daa4b5$190eff20$4b2cfd60$@farmmaps.nz">
      <meta name="Generator"
        content="Microsoft Word 15 (filtered medium)">
      <div class="WordSection1">
        <p class="MsoNormal"><span>Hi Nigel</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>Thank you, that works a treat,
            although it does fail if I try to merge a line feature at
            the same time as a polygon.  That is not a big deal and can
            get around that.</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>Your comment, </span><span>“Then
            parse these through to the merge vector layer”.  I can’t see
            a way of parsing the filelist.txt to the tool. I am not
            experienced in using python.</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>Cheers</span></p>
        <p class="MsoNormal"><span>TIby</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span> </span></p>
        <div>
          <div>
            <p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span
                lang="EN-US"> Nigel Berjak - S3 Technologies <<a
                  href="mailto:nigel@s3.co.za" moz-do-not-send="true"
                  class="moz-txt-link-freetext">nigel@s3.co.za</a>> <br>
                <b>Sent:</b> Friday, May 10, 2024 6:03 PM<br>
                <b>To:</b> Nyall Dawson <<a
                  href="mailto:nyall.dawson@gmail.com"
                  moz-do-not-send="true" class="moz-txt-link-freetext">nyall.dawson@gmail.com</a>><br>
                <b>Cc:</b> Tony Shepherd (FarmMaps NZ) <<a
                  href="mailto:tony@farmmaps.nz" moz-do-not-send="true"
                  class="moz-txt-link-freetext">tony@farmmaps.nz</a>>;
                <a href="mailto:qgis-user@lists.osgeo.org"
                  moz-do-not-send="true" class="moz-txt-link-freetext">qgis-user@lists.osgeo.org</a><br>
                <b>Subject:</b> Re: [Qgis-user] Search through folders
                and combine SHP files</span></p>
          </div>
        </div>
        <p class="MsoNormal"> </p>
        <p><span>Hi</span></p>
        <p><span>For your listing, although it would not provide the
            file type i.e. point, line, polygon etc, you could simply
            create a DOS batch command (dir/s *.shp >
            shapefilelist.txt) to locate all the file and generate a
            list of their locations. Then parse these through to the
            merge vector layer. If you are merging them all into a
            Geopackage, then file type would not be relevant and you
            could then sort them once they are in a single location. I
            don't think the Geopackage would have a limitation on the
            number of files and records in it.</span></p>
        <p><span>Perhaps this can assist.</span></p>
        <div id="signature">
          <p class="MsoNormal"><span>---</span></p>
          <div>
            <p class="MsoNormal"><span>Regards,<br>
                <br>
                Nigel Berjak<br>
                S3 Technologies<br>
                Geographic Information Systems & Large Format
                Printing specialists<br>
                T: +27 33 3423681<br>
                F: +27 86 6721242<br>
                E: </span><a href="mailto:nigel@S3.co.za"
                moz-do-not-send="true"><span>nigel@S3.co.za</span></a><span><br>
                Website: </span><a href="http://www.S3.co.za"
                target="_blank" moz-do-not-send="true"><span>http://www.S3.co.za</span></a><span><br>
                <br>
                Please consider the environment before printing this
                email.</span></p>
          </div>
        </div>
        <p><span> </span></p>
        <p id="reply-intro"><span>On 2024-05-10 04:06, Nyall Dawson via
            QGIS-User wrote:</span></p>
        <blockquote>
          <div id="replybody1">
            <div>
              <div>
                <p class="MsoNormal"><span> </span></p>
              </div>
              <p class="MsoNormal"><span> </span></p>
              <div>
                <div>
                  <p class="MsoNormal"><span>On Fri, 10 May 2024 at
                      09:06, Tony Shepherd (FarmMaps NZ) via QGIS-User
                      <</span><a
                      href="mailto:qgis-user@lists.osgeo.org"
                      moz-do-not-send="true"><span>qgis-user@lists.osgeo.org</span></a><span>>
                      wrote:</span></p>
                </div>
                <blockquote>
                  <div>
                    <div>
                      <div>
                        <p class="v1msonormal"><span>Hi</span></p>
                        <p class="v1msonormal"><span> </span></p>
                        <p class="v1msonormal"><span>I have loads,
                            literally thousands, of SHP, GPKG, TAB files
                            located in loads of different folders and
                            sub-folders.</span></p>
                        <p class="v1msonormal"><span> </span></p>
                        <p class="v1msonormal"><span>Is there a plugin
                            that will trawl through a set of folders,
                            copy say just the polygons from each file
                            into a new file, and populate a field with
                            say the filename and folder the polygon(s)
                            came from?</span></p>
                        <p class="v1msonormal"><span> </span></p>
                        <p class="v1msonormal"><span>Essentially
                            combining a heap of files into one with some
                            metadata about where the data came from?</span></p>
                        <p class="v1msonormal"><span> </span></p>
                        <p class="v1msonormal"><span>Why?  I have files
                            from clients dating back about 20 years. 
                            Clients sell properties.  Properties get
                            subdivided.  New clients come and see us,
                            and often we don't realise we have GIS info
                            on file for that property from many years
                            ago, usually under a different name.  It
                            would be handy to see a polygon on the
                            screen and easily go back to some old GIS
                            data.</span></p>
                        <p class="v1msonormal"><span> </span></p>
                        <p class="v1msonormal"><span>Maybe I am missing
                            an easy tool to do this, but I can't see
                            anything obvious.</span></p>
                      </div>
                    </div>
                  </div>
                </blockquote>
                <div>
                  <p class="MsoNormal"><span> </span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span>You could use the "Merge
                      Vector Layers" tool from the Processing toolbox,
                      that does everything you want. The trickiest bit
                      would be getting a master list of ALL your
                      shapefiles/etc you want to combine and passing
                      this to the tool. It's not going to be easy from
                      the GUI itself, as that only allows you to add
                      files from a single folder at once.</span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span> </span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span>I'd run the tool on the
                      files from a single folder, then checkout the
                      processing history dialog and copy the python
                      command which corresponds to what you just did.
                      You could then adapt this command to pass a
                      complete list of all the files you want to
                      combine. (It's quite straightforward in Python to
                      build a list of files which recursively match a
                      file pattern -- see eg </span><a
                      href="https://stackoverflow.com/a/2186565"
                      target="_blank" moz-do-not-send="true"><span>https://stackoverflow.com/a/2186565</span></a><span>
                      )</span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span> </span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span>Hope that helps!</span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span>Nyall</span></p>
                </div>
                <div>
                  <p class="MsoNormal"><span> </span></p>
                </div>
                <blockquote>
                  <div>
                    <div>
                      <div>
                        <p class="v1msonormal"><span> </span></p>
                        <p class="v1msonormal"><span> </span></p>
                        <p class="v1msonormal"><span> </span></p>
                        <p class="v1msonormal"><span>Cheers</span></p>
                        <p class="v1msonormal"><span>Tony</span></p>
                        <p class="v1msonormal"><span> </span></p>
                        <p class="v1msonormal"><span>------------------------------------------------------------------------------------------------------------------</span></p>
                        <p class="v1msonormal"><strong><span>Tony
                              Shepherd</span></strong><span></span></p>
                        <p class="v1msonormal"><em><span>  GeoSpatial
                              Manager @ FarmMaps NZ & Photographer @
                              Shepherd Photos</span></em><span></span></p>
                        <p class="v1msonormal"><span> </span><span></span></p>
                        <p class="v1msonormal"><em><b><span>Phone</span></b></em><span>
                            <strong><span>–</span></strong> 027 435
                            6193  | <em><b><span>Website</span></b></em><strong><span>
                                – </span></strong></span><a
                            href="http://shepherdphotos.co.nz/"
                            target="_blank" moz-do-not-send="true"><span>shepherdphotos.co.nz</span></a><span></span></p>
                        <p class="v1msonormal"><em><b><span>Email</span></b></em><strong><span>
                              – Maps</span></strong><span> </span><a
                            href="mailto:tony@farmmaps.nz"
                            moz-do-not-send="true"><span>tony@farmmaps.nz</span></a><span> 
                            |  <em><b><span>Email</span></b></em><strong><span>
                                – Photos</span></strong>  </span><a
                            href="mailto:tony@shepherdphotos.co.nz"
                            moz-do-not-send="true"><span>tony@shepherdphotos.co.nz</span></a><span></span></p>
                        <p class="v1msonormal"><em><b><span>Facebook</span></b></em><span>
                          </span><a
href="https://www.facebook.com/TonyShepherdPhotos" target="_blank"
                            moz-do-not-send="true"><span>TonyShepherdPhotos</span></a><span></span></p>
                        <p class="v1msonormal"><span> </span><span></span></p>
                        <p class="v1msonormal"><span> </span><span></span></p>
                        <p class="v1msonormal"><span><img
id="v1m_8596937801374573577Picture_x0020_1"
src="cid:part1.gRrJRuoi.oKx8lsru@spatialys.com"
                              alt="FM_logo1_small (Custom)" class=""
                              width="160" height="75"></span><span></span></p>
                        <p class="v1msonormal"><span> </span></p>
                      </div>
                    </div>
                    <p class="MsoNormal"><span>_______________________________________________<br>
                        QGIS-User mailing list<br>
                      </span><a href="mailto:QGIS-User@lists.osgeo.org"
                        moz-do-not-send="true"><span>QGIS-User@lists.osgeo.org</span></a><span><br>
                        List info: </span><a
href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
                        target="_blank" moz-do-not-send="true"><span>https://lists.osgeo.org/mailman/listinfo/qgis-user</span></a><span><br>
                        Unsubscribe: </span><a
href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
                        target="_blank" moz-do-not-send="true"><span>https://lists.osgeo.org/mailman/listinfo/qgis-user</span></a><span></span></p>
                  </div>
                </blockquote>
              </div>
            </div>
          </div>
          <p class="MsoNormal"><span> </span></p>
          <div>
            <p class="MsoNormal"><span>_______________________________________________<br>
                QGIS-User mailing list<br>
              </span><a href="mailto:QGIS-User@lists.osgeo.org"
                moz-do-not-send="true"><span>QGIS-User@lists.osgeo.org</span></a><span><br>
                List info: </span><a
href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
                target="_blank" moz-do-not-send="true"><span>https://lists.osgeo.org/mailman/listinfo/qgis-user</span></a><span><br>
                Unsubscribe: </span><a
href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
                target="_blank" moz-do-not-send="true"><span>https://lists.osgeo.org/mailman/listinfo/qgis-user</span></a><span></span></p>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
QGIS-User mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-User@lists.osgeo.org">QGIS-User@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>