Page 1 of 1

Check whether the Drive is valid or not ?

Posted: Wed Jul 05, 2017 2:11 am
by SITL
Dear Francesco,
For checking whether the Drive is valid or not,
Here is some work around...

Set Variable MYSPACE to
Set Variable MYPATH to D:\TestPath
Set Variable MYPATH_PARSED to

Parse String $MYPATH$ into Variables MYPATH_PARSED and (Split at first occurrence of pattern)

Get Total Space on $MYPATH_PARSED$ into variable MYSPACE

MYSPACE is Zero for invalid drive.

I feel, it's simpler than calling a library function & parsing.
Appreciate your comment.
Regards
SITL

Re: Check whether the Drive is valid or not ?

Posted: Wed Jul 05, 2017 5:00 am
by FrancescoT
Dear SITL,

you can even use your approach and then to consider "MYSPACE = 0" as an invalid drive. However, this only tells you if the specific target drive has space available and not if this exists.

Hope this helps you.

Regards