Click here to save this page

** Utility to Reindex Tables with CDX Index



** You can use this generic routine to reindex all tables in your data directory without need to specify individual table names. This will work in FoxPro Dos 2 version to the current VFP 8 version. For VFP versions a separate indexing facility to drop the index and rebuild it is provided separately in these pages.
**********************************************************
** Author      : Ramani (Subramanian.G)
**               FoxAcc Software / Winners Software
** Type        : Freeware with reservation to Copyrights
** Warranty    : Nothing implied or explicit
**********************************************************
** Purpose ... ReIndex Tables in a directory
** HowRun..... DO myReIndex WITH "myDataDir"
** .....OR.... = ReIndex("myDataDir")
**********************************************************
** Save this as "myReIndex.PRG"
PARAMETERS myDataDir
SET EXCLUSIVE ON
LOCAL aFiles, nCount, I
DIMENSION aFiles(1,1)
nCount = ADIR(aFiles,myDataDir+"\"+"*.DBF")
=ASORT(aFiles,1)
I=1
FOR I = 1 TO nCount
   WAIT WINDOW "Reindexing "+aFiles(I,1)+ ;
               " ... Please wait" NOWAIT
   SELECT 0
   USE myDataDir+"\"+(aFiles(I,1))
   REINDEX
   USE
   WAIT CLEAR
ENDFOR
SET EXCLUSIVE OFF
RETURN
**********************************************************
** EOF
**********************************************************

Home       Feedback       DataBase       VisualFoxProFAQ