program Reindex;{$mode objfpc}{$H+}uses { We will require the following units be in the USES clause: } Dbf, db, Dbf_Common, SysUtils, { The Dbf is put there e.g. when you drop a TDbf component on a form... } { but you will need db for the DataSet object and Dbf_Common } { for things such as the field type definitions } { Finally, use SysUtils for ForceDirectories. } {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes { you can add units after this };var MyDbf: TDbf;begin MyDbf := TDbf.Create(nil); try { make sure the data directory exists: } ForceDirectories('data'); { use relative path to "data" directory } MyDbf.FilePath := 'data' + DirectorySeparator; // Note: November 2011: tablelevel 25 does not seem to work... MyDbf.TableLevel := 4; MyDbf.Exclusive := True; MyDbf.TableName := 'vyr.dbf'; MyDbf.Open; MyDbf.OpenIndexFile('VYR~V.IDX'); //MyDbf.OpenIndexFile('VYR.CDX'); MyDbf.RegenerateIndexes; MyDbf.Close; finally MyDbf.Free; end; readln;end.