cfclient.file.createDirectory

Creating a directory

You can create a directory on the device as shown in the following code example:  

<cfset newdir = “myNewDir” />
<cfset dirobj=cfclient.file.createDirectory(newdir)>


You can specify both absolute and relative path for the new directory. By default, the directory will be created on the device’s memory card.

Method summary

createDirectory(dirPath, [throwError])

  • returns DirectoryEntry object
  • params

-          dirPath – Relative/Absolute path of the directory to be created (including the directory name).

  • throwError - A boolean value indicating whether an error should be shown when the directory exists.

Reading the properties of file and directory objects

The following sample code shows how you can read directory object properties:

<cfclient>
<cfset dirobj=cfclient.file.createDirectory('myNewDir')>
<cfset evalStr = "document.getElementById('divId').innerHTML='" &
dirobj.fullPath & "'">
<cfset eval(#evalStr#)>
</cfclient>

Examples

See Using the File APIs

Get help faster and easier

New user?