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

Be Sociable, Share!

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>