better yet something like for f in *.shp; do ogr2ogr -f "ESRI Shapefile" -clipsrc mask.shp `basename $f .shp`_clip.shp $f; done;
On Mon, May 7, 2012 at 10:51 AM, Salvatore Larosa <[email protected]> wrote: > Il giorno lun, 07/05/2012 alle 19.56 +0700, Koos Hagg ha scritto: >> Hi All, >> have been searching around for the answer to this question, and found >> an old thread on this list. >> >> I have a folder which contains about 30 shapefiles, old (but still >> useful) vmap0 data, but it is 500mb in size. I'd like to clip each >> shapefile to just the region I need. >> I understand about ogr2ogr, and I could do it one by one, >> >> but I would like to figure out how to write a batch file to do it all >> at once. However- I have been trying this and that for a while, not >> making any progress. >> >> any help is appreciated! >> > Hi Koos, > I didn't test it! > > #!/bin/bash > i=1; > for f in *.shp; do > ogr2ogr -f "ESRI Shapefile" -clipsrc mask.shp `basename > $f .shp`_out_[$i].shp $f; > i=$((i+1)); > done; >> > Hope this helps! > > Regards, > > -SL > > > -- > Salvatore Larosa > linkedIn: http://linkedin.com/in/larosasalvatore > twitter: @lrssvt > skype: s.larosa > IRC: lrssvt > > _______________________________________________ > Qgis-user mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-user _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user
