; * Create the TIMESTAMP
; a TIMESTAMP is not strictly necessary!
;why are you using this below?
IF @MONTHNO < 10
$MONTH= "0" + @MONTHNO ;notice - no " " on macros.
ELSE
$MONTH= @MONTHNO
ENDIF
IF @MDAYNO < 10
$DAY= "0" + @MDAYNO
ELSE
$DAY= @MDAYNO
ENDIF
;Why are you using this above?
$timestamp = "@YEAR" + "-" + "$MONTH" + "-" + "$DAY" + " " + @TIME
$ComputerName = @WKSTA
; ------------------------------------------------------------------------
; * Create an antry in auditfile1 or auditfile2 relating to date held for
;C:\program files\file1.txt and c:\ program files\file2.txt respectively
; ------------------------------------------------------------------------
$logfile1 = "I:\foldername\auditfile1.txt."
$logfile2 = "I:\foldername\auditfile2.txt"
$Result1 = GetFileTime("C:\program files\file1.txt") ; " " is a string,
$Result2 = GetFileTime("C:\program files\file2.txt") ; not a variable.
$ = Open (3,$logfile1) ;need to specify more options for the open.
if len($Result1)>0
$Result1string = "$TIMESTAMP;$ComputerName;$Result1"
$x = WriteLine( 3 , $Result1string + Chr(13) + Chr(10) ) ; you had specified it here tho..
endif
$ = Close ($logfile1) ;but not here
$ = Open ($logfile2) ; not here
if len($Result2)>0
$Result2string = "$TIMESTAMP;$ComputerName;$Result2"
$x = WriteLine( 3 , $Result2string + Chr(13) + Chr(10) )
endif
$ = Close ($logfile2) ;nor here.
exit