Ever get an error message when opening a shapefile like, “Number of shapes does not match number of table records”? Yeah, well, neither have I. But if you ever do have such a problem, the Shape Checker utility might be able to rescue at least some, if not most of your data. It can re-generate a new .shx index file for your .shp file, add or delete lines to the .dbf file to match the number of shapes, and if your DBF file is totally hosed, can recreate a blank DBF for that shapefile. Not great, since you’ll lose whatever data you had in that datafile, but better than losing everything.
As the web page suggests, it’s probably best to do this on a copy of the corrupted file, rather than the original itself. Run the program:
Select the problematic .shp file with the left button, then recreate the .shx file with the “Build Shx” button. You can then check the DBF file for the proper number of records with the Check DBF button; if there are problems, or if the DBF file is missing, you’ll be given the option to fix it or create a blank one from scratch. I’ve tried it on point, line and polygon shapefiles I screwed up deliberately, and it worked as advertised. The program hasn’t been updated since 1999, but the author also provides the Delphi source code if you want to modify it yourself.