FileOps.$deletefile()

Function groupExecute on clientPlatform(s)
FileOpsNOAll

Syntax

FileOps.$deletefile(cPath[,bDeleteContents=kFalse,bRecursive=kFalse])

Description

Deletes the file or folder named cPath. bDeleteContents deletes files inside cPath. bRecursive deletes sub-folders inside cPath if bDeleteContents is true.

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 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