Skip to content

Instantly share code, notes, and snippets.

@oeon
Created February 17, 2011 00:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oeon/830644 to your computer and use it in GitHub Desktop.
Save oeon/830644 to your computer and use it in GitHub Desktop.
batch upload folder of shapefiles which are all in same .prj to PostGIS database
#!/bin/bash
FILES=$(ls *.shp | sed 's/\..\{3\}$//');
for FILE in $FILES
do
shp2pgsql -s 4326 -I -k ${FILE} gis.${FILE} | psql -d HSIP
done
@paul-english
Copy link

Command Line Ninja!

@oeon
Copy link
Author

oeon commented Feb 17, 2011

https://github.com/frewsxcv pointed out that using 'ls' instead of 'find' would have been cleaner - - because it doesn't print the path...all my layers loaded with './' prepended to the name.

@patdevinwilson
Copy link

dang! That's awesomely short!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment