Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to compare EXE files both on server and client PC's
Message
De
06/08/2004 08:42:00
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00931258
Message ID:
00931265
Vues:
28
Hi,

>>
I want to create a simple starter for my applications.
it will check the myapp.exe file (timestamp,size,date or etc) on the server side and compare with client side myapp.exe file . if server side myapp.exe is newer version than client side exe version ,then it will copy new version exe file to the client pc .

How can i do this ?
>>

Here's a crude outline of what I use:
lcExecutionPath = JUSTPATH(SYS(16))+"\"
lcPath = SET("PATH")
lcSetSafe = SET("Safety")
SET PATH TO lcExecutionPath
SET SAFETY OFF

IF !EMPTY(lcCommonFilesPath)
  =ADIR(fred,lcCommonFilesPath+"*.*")
  IF TYPE("fred")="C"
    * Some files found
    LOCAL i
    FOR i = 1 TO ALEN(fred,1)
      DO CASE
      CASE !FILE(fred(i,1))
        * This file not present in executable directory
        llCopyThis = .T.
      CASE FDATE(fred(i,1)) < fred(i,3)
        * File in Executable is earlier date than one in CommonFiles
        llCopyThis = .T.
      CASE FDATE(fred(i,1)) =  fred(i,3) .AND. CTOT(FTIME(fred(i,1))) < CTOT(fred(i,4))
        * Files have same date but time on executable is newer
        llCopyThis = .T.
      OTHERWISE
        * Don't copy this file
        llCopyThis = .F.
      ENDCASE
      IF llCopyThis
        COPY FILE (lcCommonFilesPath+fred(i,1)) TO fred(i,1)
      ENDIF
    ENDFOR
  ENDIF
ENDIF
SET SAFETY &lcSetSafe.
SET PATH TO (lcPath)
lcCommonFilesPath needs to be populated somewhere and you'll need some error checking. This checks and transfers all files in the 'source' folder...
HTH,
Viv
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform