vfs.delete-directory

function

Library: File system utilities (OMVFS)
Import : omvfs.xmd

Declaration
export external function delete-directory
                value string path
        on      value directory on-dir optional
        contents value switch contents optional initial {contents-not-included}

Argument definitions

path
The directory to be deleted
dir
A connected vfs.directory object. It this parameter is specified, the path parameter is interpreted relative to the vfs.directory and must be in URL format.
contents
A switch indicating if the directory contents are to be deleted. The default is that directory contents are not to be deleted (contents-not-included).


Purpose

You can use vfs.delete-directory to remove an existing directory. The following program will remove a directory and all its contents from the local file system.

  import "omvfs.xmd" prefixed by vfs.
  
  process
    vfs.delete-directory "/Program Files/Games/oldVersions"
    contents vfs.contents-included

If you want the contents of the directory to be deleted, you must specify the contents parameter with a value of vfs.contents-included. If vfs.contents-included is not specified, and the directory is not empty, exception VFS305 will be thrown and the directory will not be deleted.

Exceptions

The following exceptions may occur: