I have a small Python script which is supposed to delete a shapefile in case the file is empty.
import sys from osgeo import ogr drv = ogr.GetDriverByName("ESRI Shapefile") ds = drv.Open(inData) if ds is None: print "Could not open file." sys.exit(1) lyr = ds.GetLayer() if lyr.GetFeatureCount() == 0: drv.DeleteDataSource(inData)
everything seems to work fine. The shapefile consists of
whereas only the *.prj and *.shx get deleted. the *.dbf and *.shp are untouched. Is there anything I am missing?