<div dir="auto"><div>Tony and list,<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 9, 2024, 16:06 Tony Shepherd (FarmMaps NZ) via QGIS-User <<a href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-NZ" link="#467886" vlink="#96607D" style="word-wrap:break-word"><div class="m_6460553185179491934WordSection1"><p class="MsoNormal">Hi<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I have loads, literally thousands, of SHP, GPKG, TAB files located in loads of different folders and sub-folders.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">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?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Essentially combining a heap of files into one with some metadata about where the data came from?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">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.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Maybe I am missing an easy tool to do this, but I can’t see anything obvious.</p></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Have you considered creating a PostGIS database, where each file imported is in a table named for the source? You could also create a companion metadata table.</div><div dir="auto"><br></div><div dir="auto">You would script something like this with shp2pgsql</div><div dir="auto"><br></div><div dir="auto"><a href="https://postgis.net/docs/using_postgis_dbmanagement.html">https://postgis.net/docs/using_postgis_dbmanagement.html</a></div><div dir="auto"><br></div><div dir="auto">To load the spatial data and likely the psql client with CREATE TABLE and INSERT statements in an SQL script.</div><div dir="auto"><br></div><div dir="auto">If you're on Linux or OS/X you would use the find command to create the shell script. Probably something similar in Power Shell if you're on Windows.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>