Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to compare EXE files both on server and client PC's
Message
From
06/08/2004 08:42:00
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00931258
Message ID:
00931265
Views:
29
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform