webCOMAND

util::delete()

Delete a file or folder, including any sub-folders, recursively.

Prototype

delete(string $path, bool $force = FALSE)

Parameters

  • path - Path to the file or folder to delete.
  • force - TRUE to delete files and folders, even they are outside the webCOMAND Files folder.

Exceptions

The function will throw an exception if the path and files and sub0folders can not be deleted.

Example

// recursively delete a directory under webCOMAND's Files path
try {
    \io_comand_file\util\delete('dir');
} catch(\exception $e) {
    \comand::log_error("Could not delete dir: " . $e->getMessage());
}