Postgis data loader from shapefile bash shell script

By John C. Zastrow

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