Skip to content

Instantly share code, notes, and snippets.

@tparton42
Created June 14, 2013 16:21
Show Gist options
  • Save tparton42/5783254 to your computer and use it in GitHub Desktop.
Save tparton42/5783254 to your computer and use it in GitHub Desktop.
Example of how to use the Java IO File class inside a ColdFusion Function to determine the amount of free space.
<cffunction name="getFreeSpace" displayname="getFreeSpace" description="Use Java.io.File to return amount of free space in target path" access="public" output="false" returntype="any">
<cfargument name="path" displayName="path" type="string" hint="File path" required="true" />
<!--- Create an instance of the Java IO File Class --->
<cfset var objFile = createObject("java", "java.io.File").init(arguments.path)/>
<!--- Return the amount of free space --->
<cfreturn objFile.getFreeSpace() />
</cffunction> <!--- End: checkFreeSpace() --->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment