Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / June 2009



Tip: Looking for answers? Try searching our database.

coldfusion-display free disk space

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Garry - 25 May 2009 01:30 GMT
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
nkosi - 03 Jun 2009 05:13 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.