View Full Version : Determining the Amount of Free Space on a Drive

10-03-2003, 10:50 AM
<HTML> <HEAD> <TITLE>AutoPlay Media Studio 5.0 Knowledge Base</TITLE> </HEAD> <BODY> <h3>Determining the Amount of Free Space on a Drive </h3> <b>Document ID: IR10072</b> <hr> The information in this article applies to: <ul> <li>AutoPlay Media Studio 5.0 Professional Edition</li> </ul> <hr> <h3>SUMMARY</h3> <p>This article describes how to determine if the user has a sufficient amount of free space on their system.</p> <h3>DISCUSSION</h3> <p> When installing software to a user's system, it is useful to ensure that the user's system has enough free space on their hard drive to accommodate the software.<br> <br> To accomplish this in AutoPlay Media Studio 5.0, insert the following code into any event in your application:<pre><code>--space required, in megabytes
<br />space_required = 253
<br />
<br />--get free space on the user's system (c:\ drive)
<br />space_available = Drive.GetFreeSpace("C:");
<br />
<br />--compare free space available to free space required
<br />if space_required > space_available then
<br /> Dialog.Message("","You are "..(space_required - space_available).." MB short");
<br />else
<br /> Dialog.Message("","You have "..(space_available - space_required).." MB more than you need");
<br />end</code></pre> Please note that the variable space_required must be set by you. 253 is an arbitrary number. <h3>MORE INFORMATION</h3> <p>For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:</p> <ul> <li><b>Program Reference | Actions | Drive | Drive.GetFreeSpace</b></li> </ul> <p>KEYWORDS: AutoPlay Media Studio 5.0, Drive, Free Space, Required </p> <hr> <FONT SIZE=1> Last reviewed: October 3, 2003<br> Copyright 2003 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br> </FONT> </BODY> </HTML>