(VFP) - How to Pack data automaticaly
This code show u how to do it
******************
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
******************
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
Comments