List of available drives on MS OS's

rob bradford

New Member
All.

I know how to get usage and drive type information via API calls but I cant sort out a reliable method of dynamically building a list of available drives. As this code must run on various machines I need to build this list at runtime.

HOW? An API call would be nice, but I'm open to ideas.

Why do I want to do this, well there is a requirement to monitor disc usage across available drives after nightly uploads, and e-mail the appropriate people is a threshold for minimum acceptable space is crossed. (e-mail is via a mappi thingy). All works fine but I would like to build a drive list dynamically.

Weeding out CD's, removable drive's ect is done.

Thanks in advance.

Rob.B.:confused:
 

M-HT

Member
Hi Rob,
how about this simple solution (there may be better, but this one works (more or less) ) :

def var i as int no-undo.

do i = asc("c") to asc("z"):
file-info:file-name = chr(i) + ":\.".
if file-info:full-pathname <> ? and index(file-info:file-type, "d") <> 0 then message "drive " + chr(i) + "is available".
end.

All you need is to sort out removable, network,... drives, but you wrote you know how to do that so it's no problem for you.
 

rob bradford

New Member
Thanks.

Thanks Roman, a minor tweek and it doe's the job. Funny how the simplest of solutions eludes you at times. Talk aboun not being able to see the woods for the trees!

Rob.B.
 
Top