[postgis-users] bulk conversion from shapefiles
strk
strk at keybit.net
Thu Sep 16 01:21:42 PDT 2004
On Thu, Sep 16, 2004 at 12:48:59AM -0700, Dylan Keon wrote:
> strk wrote:
> >On Thu, Sep 16, 2004 at 12:06:28AM -0700, Michael Mallete wrote:
> >
> >>hello sir! would you it be ok if i ask you to share
> >>the script? or at list give some hints? it would be of
> >>great help. i'd do anything just to avoid manually
> >>importing 900 shapefiles. :)
> >>
> >>thank you so much! have a nice day! :)
> >
> >
> >for shapefile in `find . -name '*.shp'`; do
> > shp2pgsql $shapefile .....
> >done
>
> You could also do a one-liner:
>
> find . -name '*.shp' -exec shp2pgsql {} \;
Both versions acually miss filenames containing spaces
(I've seen many around!). So a better version would be:
find . -name '*.shp' | while read shapefile; do
shp2pgsql "$shapefile" ...
done
--strk;
More information about the postgis-users
mailing list