Hello All,

I'm working on my very first kix script and running into trouble. Essentially we have an update to a program we use in the office that simply requires an MDE file to be replaced on the user's workstation. Since the environment is not managed very well I'm trying to put in some checks to make sure the file that needs to be replaced is actually there. Since this script will run at login for a few days as users come in and out of the environment I want to make sure it doesn't keep replacing the file for users that have already had it replaced. My newb way to do this was to do a filesize comparison and then if its different to replace the file. I also wanted to create a log file of what's going on. So after all that, here is the script I came up with (specific paths and company info snipped):

$wrkFile="[snip]balaboss.mde"
$ServFile="[snip]balaboss.mde"
$Logfile = "c:\" + @month + @mdayno + ".log"

If Exist ($wrkFile)
$wrksize=getfilesize($wrkfile)
$servsize=getfilesize($servfile)
IF $wrksize<>$serversize
copy $servfile "[snip]balaboss.mde"
$operation = "file replaced"
else
$operation = "file left alone"
endif
else
$operation = "file not found"
endif
If Open (1,$logfile,5) = 0
Writeline (1, @wksta + " / " + @userid + @CRLF + "Workstation File Size = " + $wrksize + " " + "Server File Size = " + $servsize + @CRLF + "Result = " + $operation + @CRLF + @CRLF+ @CRLF)
Close(1)
Endif

The trouble that I am running into is that it appears to still be copying the file over even when its the same size (at least that's what my $operation variable is showing). Here's an part of the output log for 3 attempts (first with the file missing from the workstation, second with the old file where it should be, and third after the file has been updated):

workstation / username
Workstation File Size = Server File Size =
Result = file not found


workstation / username
Workstation File Size = 46123008 Server File Size = 46630912
Result = file replaced


workstation / username
Workstation File Size = 46630912 Server File Size = 46630912
Result = file replaced


Can anyone point me to where I'm going wrong. I'm also open to revamping the whole thing if anyone has a better suggestion on how to code it so the it checks if the file exists and is different from the new one (file size was the first thing I could come up with).

Many thanks in advance.