LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I get Labview to give me a array of what hard drives are on my local computer???

Hi there,

What I want to do is automatically search the computer for any hard drives it has,
so that the app can work on any computer.

The aim is to use volume info, to monitor all of the hard drives,
and when the drive is say 90% full, it can send out an e-mail warning you off this.

I can self specify the drive letters, but can it be done automatically??

Thanks,

Pete
0 Kudos
Message 1 of 15
(5,532 Views)
Sure. Strip the path from c:\, like this.

___________________
Try to take over the world!
0 Kudos
Message 2 of 15
(5,522 Views)
I would stay away from doing string manipulations on paths (e.g. append ":/"), because it breaks platform independence.

Just wire an empty path to "List Directory". Wire the directory names array output to a FOR loop containing "Build Path" followed by "Volume Info" to get the desired information. The code picture shows an example how to display it in a table (...which reminds me to get a bigger drive ;)).
Message 3 of 15
(5,511 Views)
Obviously, Altenbach's right (more right, that is). I never actually worked with multiple drives (or did multiplatforms), so I learned both that empty path gives you the base path and that you can use build path with a drive letter. Thanks, Altenbach.

___________________
Try to take over the world!
Message 4 of 15
(5,498 Views)


@tst wrote:
Sure. Strip the path from c:\, like this.


You do not need to strip the path, just wire an empty path constant to it. Albeit not well documented, the List Directory function treats an empty path as the root of the file system and for Windows this is the container hosting all drives. It is supposed to be platform independant, so a good way to completely and recursively enumerate the entire filesystem.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 5 of 15
(5,342 Views)

Very nice Altenbach,

I would have stopped at the drive letters only.  But I like the way you display the drive info.  It may (probably will) be useful one day.

Thanks,

Ray

Message 6 of 15
(5,320 Views)
I love your solution, altenbach.  How do you prevent it from returning an error when it gets to an empty drive (floppy or CD)?  I can see skipping a:, but how do you know apiori which drives are cd drives?
0 Kudos
Message 7 of 15
(5,305 Views)
You could just tap into the error output of "Volume info", so inaccessible volumes don't show up in the list. See attached.
 

Message Edited by altenbach on 01-13-2006 09:24 AM

Download All
Message 8 of 15
(5,282 Views)
Ah, excellent.

A side note: LV8 changed the behaivor of Volume Info.  It now outputs I64 values for size and free rather than DBL for size ,used, and free.  I like that the sizes are now interger (as it should be) and 64 bit will be important as disk sizes continue to grow. But I am flummuxed as to why they chose I64 over U64.  How do you have a negative volume size?
0 Kudos
Message 9 of 15
(5,266 Views)
I think even the range of I64 should be enough for a little while in the future. 😄
 
Sometimes, signed integers are a bit more flexible, because you could for example indicate an error condition with a negative output. Remember, Integers have no special values such as NaN, Inf, etc.
Message 10 of 15
(5,258 Views)