ColdFusion 9.0 Resources |
DirectoryDeleteDescriptionDeletes on-disk or in-memory directory. CategoryFunction syntaxDirectoryDelete(path [, recurse]) HistoryColdFusion 9: Added this function Parameters
UsageEnsure that you have the required permissions to run this function. Example<h2>DirectoryDelete Example</h2> <h3>Enter a directory to delete.</h3> <form action = "directoryDelete.cfm" method="post"> <label for="delDirectory">Directory Path: </label><input type = "text" id="delDirectory" name = "delDirectory"> <br> <label for="recurse">Recurse: </label><input id="recurse" type="checkbox" value="recurse" name="recurse"> <br> <input type = "submit" value="submit" name = "submit" onclick='return confirm("Are you sure !!!");'> </form> <cfif IsDefined("FORM.delDirectory")> <cfif FORM.delDirectory is not ""> <cfset delDirectory = FORM.delDirectory> <cfset recurse = false> <cfif isDefined("FORM.recurse")> <cfset recurse = true> </cfif> <cftry> <cfset DirectoryDelete(delDirectory,recurse)> <cfoutput><p>Directory <b>#delDirectory#</b> has been deleted.</cfoutput> <cfcatch> <b>Error Message:</b><cfoutput>#cfcatch.message#</cfoutput><br/> <b>Error Detail:</b><cfoutput>#cfcatch.Detail#</cfoutput> </cfcatch> </cftry> </cfif> </cfif> |