Skip to content

Instantly share code, notes, and snippets.

@jgcasta
Created August 27, 2014 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgcasta/685ca7d55638545f18a8 to your computer and use it in GitHub Desktop.
Save jgcasta/685ca7d55638545f18a8 to your computer and use it in GitHub Desktop.
Shell script to merge a list of SHP files from a set of directories
#!/bin/bash
ogr2ogr -a_srs EPSG:4326 out.shp
directories=$(find . -type d)
for directory in $directories
do
files=$(find $directory -name '*.shp')
for file in $files
do
echo $file
ogr2ogr -append -update out.shp $file -f "Esri Shapefile"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment