• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Determine free space on Windows volume

New Here ,
Nov 12, 2008 Nov 12, 2008

Copy link to clipboard

Copied

Does CF 8 support easy way to determine free space on a volume on Windows 2003? I've done it via CFEXECUTE cmd.exe "dir /w" and parsing the result, but there must be a better way. Perhaps w/ Java object?
TOPICS
Advanced techniques

Views

369

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Nov 12, 2008 Nov 12, 2008
Try using java.io.File. Read the api for the applicable disclaimers.
http://java.sun.com/javase/6/docs/api/java/io/File.html#getFreeSpace()

<cfset f = createObject("java", "java.io.File").init(pathToVolume)>
<cfset free = f.getFreeSpace() >
<cfset total = f.getTotalSpace() >

<!--- function found at: http://cflib.org/udf/ByteConvert --->
<cfoutput>
total = #byteConvert(total, "MB")#
free = #byteConvert(free, "MB")#
</cfoutput>

Votes

Translate

Translate
Valorous Hero ,
Nov 12, 2008 Nov 12, 2008

Copy link to clipboard

Copied

Try using java.io.File. Read the api for the applicable disclaimers.
http://java.sun.com/javase/6/docs/api/java/io/File.html#getFreeSpace()

<cfset f = createObject("java", "java.io.File").init(pathToVolume)>
<cfset free = f.getFreeSpace() >
<cfset total = f.getTotalSpace() >

<!--- function found at: http://cflib.org/udf/ByteConvert --->
<cfoutput>
total = #byteConvert(total, "MB")#
free = #byteConvert(free, "MB")#
</cfoutput>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 12, 2008 Nov 12, 2008

Copy link to clipboard

Copied

LATEST
Appears to work in my installation. Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation