Click here to save this page

** Utility to Pack Data Files



** You can use this generic routine to pack all tables in your data directory without need to specify individual table names. This will work from FoxPro Dos 2 to current VFP 8 version.
**********************************************************
** Author      : Ramani (Subramanian.G)
**               FoxAcc Software / Winners Software
** Type        : Freeware with reservation to Copyrights
** Warranty    : Nothing implied or explicit
**********************************************************
** Purpose ... Pack ALL Tables in a directory
** HowRun..... DO myPack WITH "myDataDir"
** .....OR.... = myPack("myDataDir")
**********************************************************
** Save this code as "myPack.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))
   PACK
   USE
   WAIT CLEAR
ENDFOR
SET EXCLUSIVE OFF
RETURN
**********************************************************
** EOF
**********************************************************

Home       Feedback       DataBase       VisualFoxProFAQ