FileDelete

Deletes files.

Syntax:

FileDelete (file-list)

Parameters:

(s) file-list a string containing one or more filenames, which may be wildcarded. (example: "*.jpg|*.bmp")

Returns:

(i) @TRUE if all the files were deleted.; @FALSE if a file cannot be deleted (marked with the READ-ONLY attribute).

 

File-list may contain * and ? wildcards.

Use this function to delete an individual file, a group of files using wildcards, or several groups of files by separating the names with a delimiter.

Windows Vista/2008 and newer: This function may require an Administrator level account if dealing with files located in a protected directories: 'Program Files' and 'Windows'.

This function supports extended-length path names.

Example:


temp=Environment("TEMP")
DirChange(temp)
testfile1="test1.bak"
testfile2="temp123.fil"
handle = FileOpen(testfile1, "write")
FileWrite(handle, "dummy data one")
FileClose(handle)
handle = FileOpen(testfile2, "write")
FileWrite(handle, "dummy data two")
FileClose(handle)
Pause("FileDelete","OK to delete *.bak and temp123.fil files from %temp%")
FileDelete("*.bak|temp123.fil")
See Also:

FileExist, FileLocate, FileMove, FileRename