Description

Deletes a directory if it is empty, and/or all the files in the directory.

Syntax

success = RTI_OS_Directory( "DELETE", directory <, files> <, deleteDir> )

Parameters

directoryThe directory path to be deleted.
files<Optional> The file(s) to be deleted.

If null and the directory is empty then the directory itself will be deleted. Multiple filenames should be @fm-delimited, @vm-delimited or comma-delimited. This method does support the question mark (?) and asterisk (*) wildcards. To delete all .doc files in a directory pass *.doc

deleteDir<Optional> If TRUE, will delete the directory after all the files are deleted.

The default value is FALSE.

Return Value

A boolean value.

Remarks

A directory will only be deleted if it is empty.

Example 1

declare function RTI_OS_Directory
 
// delete a directory called mydir in c:\revsoft.
directory = "c:\revsoft\mydir"
success = RTI_OS_Directory( "DELETE", directory)

Example 2

declare function RTI_OS_Directory
 
// delete all files in the directory c:\revsoft\mydir, but do not delete the directory
directory = "c:\revsoft\mydir"
files = "*.*"
success = RTI_OS_Directory( "DELETE", directory, files )

Example 3

declare function RTI_OS_Directory
$Insert Logical
 
// delete all files in the directory c:\revsoft\mydir and delete the directory
directory = "c:\revsoft\mydir"
files = "*.*"
success = RTI_OS_Directory( "DELETE", directory, files, TRUE$)
  • No labels