Kill


Function Kill( filename )


Returns 1 on success, 0 on failure to delete filename.


Syntax Kill("Test.txt")


Remarks

Kill accepts any legal filename, including long filenames. Kill does NOT accept wildcard characters.

Kill will fail (return 0) in the following cases; The file is open, either by your script or another process. The file is set as read only by the operating system. The file does not exist.


See Also:

RmDir Name File and Directory functions


Example Script


' Clean up temporary files

STRING a


CHDIR("C:\TEMP")

a = FINDFIRST("*.tmp")

WHILE LEN(a)

IF KILL(a) THEN

PRINT "Removed "; a

ELSE

PRINT "Failed to remove "; a

ENDIF

a = FINDNEXT()

WEND



Script Output

(your results may be different)


Removed ~DF3941.TMP

Removed ~DF1542.TMP

Removed ~DF16D2.TMP

Removed ~DF346C.TMP

Removed ~DF14D4.TMP