I have a folder with 150 .gml files I need to upload to my postgis/postgres database. After the first gml is uploaded, the rest will be appended to it to form a single table. However I don't know how to make ogr2ogr iterate through each file... currently I'm having to upload/append each cml induvidually.
My code to convert the first gml:
ogr2ogr -update -append -f "PostgreSQL" PG:"host=localhost port=5432 dbname=testdb user=admin password=password" -lco SCHEMA=test_schema "D:\path to folder\File1.gml" -progress -lco OVERWRITE=YES
and my code to append each subsequent gml to the first:
ogr2ogr -update -append -f "PostgreSQL" PG:"host=localhost port=5432 dbname=testdb user=admin password=password active_schema=test_schema" "D:\path to folder\File2.gml" -progress
This works fine but I don't want to do this another 148 times, changing File2 to File3 each time etc...
Loosely copied from this question, you need a loop: