Deletes on-disk or in-memory directory at the given path. NOTE: Ensure that you have the required permissions to run this function.

directoryDelete(path[, recurse]) → returns void

Argument Reference

path string

Absolute path of the directory to be deleted. Alternatively, you can specify IP address, as in the following example: DirectoryDelete("//");.

recurse boolean
Default: false

If true, the directory and the sub-directories are deleted. If the directory (being deleted) has sub-directories and you set recurse to false, an exception occurs.

Sample code invoking the directoryDelete function

<cfset delDirectory = "someDirPath" />
<cfset recurse = true />
<cfset directoryDelete(delDirectory,recurse)>

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub