Postgis data loader from shapefile bash shell script

Run this script in a directory of shp files to create STDOUT that will load them all into postgis

——————————————————
#!/bin/sh
# jcz aug 24, 2005
# clip off the “.shp” file extensions before use
# drops existing shapes if they are the same name

for z in `ls *.shp
do
echo “shp2pgsql $z $z > $z.sql”
echo “psql -d -f $z.sql”
done

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.