Prev: Streamlight 90041 Survivor Flashlight Division 2 Fast PiggyBack Charger with AC Cord, Orange
Next: Arbitrary-precision arithmetic in ColdFusion?
From: Garry on 24 May 2009 20:30 I want to display the amount of free space on the local C: drive, on the computer that coldfusion is running. any suggestions please. thanks Garry
From: nkosi on 3 Jun 2009 00:13
Assuming you're on a Windows machine using CF8 these are two methods that I am aware of: 1) Using .Net version 2 or greater - see http://www.forta.com/blog/index.cfm/2007/5/30/GetDriveInfo-UDF-Powered-By-NET 2) Using Java - <cfobject type="java" action="create" class="java.io.File" name="objFile"> <cfobject type="java" action="create" class="javax.swing.filechooser.FileSystemView" name="objFSVTemp"> <cfset arrRoots = objFile.listRoots()> <cfset iArrayLen = ArrayLen(arrRoots)> <cfset objFSV = objFSVTemp.getFileSystemView()> <cfloop from="1" to="#iArrayLen#" index="i"> <cfoutput> <strong>Drive: #arrRoots[i]#</strong><br /> Available Space: #arrRoots[i].getFreeSpace()#<br /> Total Space: #arrRoots[i].getTotalSpace()#<br /> <br /> </cfoutput> </cfloop> Hope that helps. Cheers Glen |