- February 8, 2017
- Posted by: user
- Category: Uncategorized
No Comments
For one of my project where we were building file manager to give selection of server file, here we need list of drive letters to allow user to switch over drive. But I realize that cfdirectory doesn’t give list of drives but obvioiusly our second choise is Java File component.
Below is code will retrive list of all drives.
[code:cf]
<cfset fileObj = createObject("java","java.io.File") />
<cfset systemRoots = fileObj.listRoots() />
<cfloop from="1" to="#arrayLen(systemRoots)#" index="i">
<cfoutput>#systemRoots[i].getAbsolutePath()#</cfoutput>
</cfloop>[/code]