wiki:BatchCreationIndexesForShapefilesOnDOS

Version 4 (modified by aperi2007, 12 years ago) ( diff )

--

Procedure to create spatial indexes for shapefiles on DOS shell

I often need to create indexes for shapefiles. The shapefiles are on remote disc and are on many gerarchical folders
So I use this simply but surely useful procedure to create the indexes using a dos shell.


Suppose the path to the root filder of shapefile is:

F:\folder1\folder2

you must run this simply script from a shell dos.

for /R F:\folder1\folder2 %f IN (*.shp) do ogrinfo.exe -sql "CREATE SPATIAL INDEX ON %~nf" "%f"

The script start from F:\folder1\folder2 and recurse on all the folders creating the spatial index for every shapefile found.

Happy indexing.

Andrea Peri.

Note: See TracWiki for help on using the wiki.