vspacer
 
vspacer
 
Valid XHTML 1.0!
 
Valid CSS 1.0

freedrive

 

ZDS SourceSafe Tools

Purpose

This very simple utility is designed for use in batch files to monitor disc space used.

A threshold can be specified. The utility returns an exit code that can be tested in a batch file

SS

Tested with SourceSafe V5.0, V6.0.

OS

Windows NT/2K/XP Command line utility.

Usage
freedrive 1.4 syntax
freedrive X [G/M/K/B]  {FreeThresholdLimit}
         :  : : : :    :
         :  : : : :    :..In the specified units
         :  : : : :.. Bytes
         :  : : :.. KiloBytes (Kb)
         :  : :.. Megabytes (Mb)
         :  :.. Gigabytes (Gb)
         :.. Drive letter
         Drive and unit parameters are required.
         Lower or upper case acceptable.
         Threshold limit is optional.
For example :
freedrive D m 200
Output
Freedrive V1.3  Drive D: Free: 959 Mb   Used : 874 Mb   Capacity : 1833 Mb
Freedrive V1.3  Drive D: Free space is above the : 200 Mb safety threshold.
Returns Errorlevel
  0  Free space is greater than the threshold limit supplied.
  1  Free space is less than the threhold limit supplied.
  2  Parameter syntax error.
  3  Unable to switch to drive requested.
  4  GetFreeDiskSpaceEx function failure.

Installation

Copy the program into the directory where the batch file using it will run.

To test the exit code in your batch file insert this code:

rem : Run freedrive
freedrive D m 200
rem Report exit return from freedrive
echo off
FOR %%E IN (0,1,2) DO IF ERRORLEVEL %%E00 SET ERLVL=%%E
IF "%ERLVL%"=="0" SET ERLVL=
SET RANGE=0,1,2,3,4,5,6,7,8,9
IF "%ERLVL%"=="2" SET RANGE=0,1,2,3,4,5
FOR %%E IN (%RANGE%) DO IF ERRORLEVEL %ERLVL%%%E0 SET ERLVL=%ERLVL%%%E
IF "%ERLVL%"=="0" SET ERLVL=
IF NOT "%ERLVL%"=="25" SET RANGE=0,1,2,3,4,5,6,7,8,9
FOR %%E IN (%RANGE%) DO IF ERRORLEVEL %ERLVL%%%E SET ERLVL=%ERLVL%%%E
SET RANGE=
if ERRORLEVEL 0 if not ERRORLEVEL 1 goto Next
net send me mybatch.bat : freedrive exit code = %ERLVL%.
goto Exit
:Next
rem continue
:Exit

Download

freedrive 1.4 (41 KB)


   


Back to top | ZDS Home | This article updated January 15, 2004.