Gets information about free hard disk space or free in-memory VFS space.

getFreeSpace(path); → returns Returns the free space in bytes.

Argument Reference for the getFreeSpace function


Required: Yes
The Path to the Hard Disk Drive or to the in-memory file system - ram.

Examples sample code invoking the getFreeSpace function

Tag Syntax

In the following example, in-memory file system memory for the application is set to 20 MB in ColdFusion Administrator. The function returns 20, which means the total space considered is 20 MB. This is because the value specified in the ColdFusion Administrator (Memory Limit per Application for In-Memory Virtual File System) is lesser than the value specified in the Application.cfc (20 MB).Application.cfc

 <cfset = 'vfs_total_space'> 
 <cfset this.inmemoryfilesystem.size = 30> 

Tag Syntax


<cfset freeRAMSpace = getFreeSpace('ram:')>
 <cfset freeDiskSpace = getFreeSpace('c:')> 
 Free Application RAM Memory = #decimalFormat(freeRAMSpace / (1024 * 1024))# MB 
 <br>Free Hard Disk Space = #decimalFormat(freeDiskSpace / (1024 * 1024 * 1024))# GB  

Fork me on GitHub