If you have a Windows computer, you can use good 'ol CMD.EXE
with a few esoteric for-loops. Make sure you do this in a "contained" directory with only the shp/sql files that you need to load.
First step, create the SQL loader files (I also assumed you have Lat/Long WGS84 data with 4326 .. update this to your SRS):
for %f in (*shp) do shp2pgsql -s 4326 %f public.%~nf > %~nf.sql
Then check your SQL files to make sure they look good, then do a similar loop:
for %f in (*sql) do psql -h myserver -d mydb -U myuser -f %f > nul
The bash
equivalent for POSIX folk (Linux, Mac OS X, etc) is something like:
for f in *.shp
do
shp2pgsql -s 4326 %f public.`basename $f .shp` > `basename $f .shp`.sql
done
then
for f in *.sql
do
psql -h myserver -d mydb -U myuser -f $f > /dev/null
done
or both parts piped into a single loop, if you don't need to keep the interim .sql
files:
for f in *.shp
do
shp2pgsql -s 4326 %f public.`basename $f .shp` | psql -d mydb > /dev/null
done