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

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy