Dear,

We create following script:

code:

$path="d:\Program Files\nav\*.vdb" ; <-- change be changed to other filenames
$temp_file="%temp%\kixtart.tmp"
;
del $temp_file
shell "%comspec% /c dir "+$path+" /o:d /b /s >"+$temp_file
shell "%comspec% /c echo ~~~completed~~~ >>"+$temp_file
IF (Exist($temp_file) = 1)
IF (Open(1,$temp_file) = 0)
$file=ReadLine(1)
$file_prev=$file
IF (INSTR($file,"~~~completed~~~") <> 0)
$completed="yes"
ELSE
$completed="no"
ENDIF
WHILE ($completed <> "yes")
$file=ReadLine(1)
IF (INSTR($file,"~~~completed~~~") = 0)
IF (GetFileTime($file) > GetFileTime($file_prev))
? " delete "+$file_prev+" ("+GetFileTime($file_prev)+" "+GetFileSize($file_prev)+" bytes)"
IF (SetFileAttr($file_prev, 32) <> 0)
? "Error "+$error+": "+@serror
ENDIF
del $file_prev
$file_prev=$file
ELSE
? " delete "+$file+" ("+GetFileTime($file)+" "+GetFileSize($file)+" bytes)"
IF (SetFileAttr($file, 32) <> 0)
? "Error "+$error+": "+@serror
ENDIF
del $file
ENDIF
ELSE
$completed="yes"
ENDIF
LOOP
?
IF (INSTR($file_prev,"~~~completed~~~") = 0)
? " most recent file = "+$file_prev+" ("+GetFileTime($file_prev)+" "+GetFileSize($file_prev)+" bytes)"
ELSE
? " no file '"+$path+"'"
ENDIF
ENDIF
ENDIF
del $temp_file

With $path="T:\*.html" we see the following information:

code:

delete t:\002200.html (2001/04/29 22:06:26 20022 bytes)
delete t:\002204.html (2001/04/29 22:13:25 20561 bytes)
delete t:\001598.html (2001/04/29 22:14:15 17062 bytes)

most recent file = t:\001590.html (2001/04/29 22:14:22 11782 bytes)



The temporary file looks like:
code:

t:\002200.html
t:\002204.html
t:\001598.html
t:\001590.html
~~~completed~~~

Second run will be

code:

most recent file = t:\001590.html (2001/04/29 22:14:22 11782 bytes)

By an empty directorie for specified file

code:

no file '*.html'

Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA