FileOps.$deletefile()

Function group Execute on client Platform(s)
FileOps NO All

Syntax

FileOps.$deletefile(cPath[deleteContents=kFalse,recursive=kFalse])

Description

Deletes the file or folder named cPath. Pathnames can be over 255 characters. The optional parameters deleteContents and recursive allow you to delete the contents of a folder (both default to kFalse, if omitted).

Files deleted with $deletefile() are not moved into the Recycled bin or Trash can, they are deleted irreversibly. You can delete a folder with $deletefile(), but only if it is empty.

The combination of the parameters has the following results:

The function returns an error code, or zero if successful: see the FileOps function error codes.

Example

Do  FileOps.$deletefile('c:\omnis\examples\extcomp\test1.txt'Returns lError
# deletes 'test1.txt' from 'c:\omnis\examples\extcomp'
Do FileOps.$changeworkingdir('c:\omnis') Returns lError
Do FileOps.$deletefile('test2.txt'Returns lError
# deletes 'test2.txt' at the current folder 'c:\omnis'
Do FileOps.$deletefile('c:\omnis\examples\extcomp\clock') Returns lError
# deletes the 'clock' folder if empty