Re: check if drive exist



hum, I didn't thought of that one
The root is ofcourse also a directory ...
but now you've mentioned it,
I did some testing and it is not reliable.
It's like Drivetype(), when there is a driveletter mapped to a drive over
the lan
and the Lan is disconnected, it still returns .t. !!

regards
christophe

--


"Fred Taylor" <ftaylor@xxxxxxxx!REMOVE> schreef in bericht
news:exhLvrKVFHA.580@xxxxxxxxxxxxxxxxxxxxxxx
> So DIRECTORY("X:\") doesn't work for you? I'd think can be pretty sure if
> that one exists, the drive exists. ;)
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "christophe" <irs.znospamforme@xxxxxxxxx> wrote in message
> news:eHiHYVJVFHA.1384@xxxxxxxxxxxxxxxxxxxxxxx
>> Just for the record...
>>
>> I did some testing and came to this conclusion
>> ADir() : is the best and fasted
>> DISKSPACE(cDriveLetter) : is to slow when there is no connnection.
>> Drivetype() : is not reliable especially when there is a driveletter
>> mapped but the Lan is disconnected.
>> directory() : I don't like and did not test because I have to hardcode a
>> "somefolder".
>>
>> regards
>> christophe
>> --
>> \|||/
>> (o o)
>> ----ooO-(_)-Ooo-------------
>>
>>
>> "Carsten Bonde" <bonde AT real-inkasso DOT de> schreef in bericht
>> news:%23kFKH$HVFHA.3280@xxxxxxxxxxxxxxxxxxxxxxx
>>> Christophe,
>>>
>>> VFP has some functions looking for info on a certain media.
>>> On my system Drive F: does not exist. These functions all returns values
>>> without crashing:
>>>
>>> ? drivetype("F:")
>>> ? adir(laFiles, "F:\*.*" )
>>> ? directory( "F:\SomeFolder" )
>>>
>>>
>>> Another approach could be to catch the error inside a TRY-CATCH-ENDTRY
>>> block:
>>>
>>> function checkdrive
>>> lparameters chkdrive_
>>> o = Create('Scripting.FileSystemObject')
>>> lreturnvalue= .T.
>>> TRY
>>> lreturnvalue = o.Drives(chkdrive_).IsReady
>>> CATCH
>>> lreturnvalue= .F.
>>> ENDTRY
>>> release o
>>> return
>>>
>>> --
>>> Cheers
>>> Carsten
>>> _______________________________
>>>
>>> "christophe" <irs.znospamforme@xxxxxxxxx> schrieb im Newsbeitrag
>>> news:O3IxuJHVFHA.2420@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Hi,
>>>>
>>>> I have this little code to check if a drive exist yes or no,
>>>> but it fails on a pentablet. I get an error specifying "Drives does
>>>> not
>>>> exist".
>>>> This pentablet has a drive (the server) only when it is docked (and
>>>> connected to a lan).
>>>> And this is just exactly what I want to prevent and checked if it is
>>> docked
>>>> or not
>>>> to perform some syncronisation with tables on the server.
>>>>
>>>> function checkdrive
>>>> lparameters chkdrive_
>>>> o = Create('Scripting.FileSystemObject')
>>>> lreturnvalue = o.Drives(chkdrive_).IsReady
>>>> release o
>>>> return lreturnvalue
>>>>
>>>> Anybody a workaround
>>>> to check when a drive exist (and is ready) ?
>>>>
>>>> thanks in advance
>>>> regards
>>>> christophe
>>>> --
>>>>
>>>>
>>>
>>>
>>
>>
>
>



.



Relevant Pages

  • Re: mailmerge new page
    ... I always did use a database field. ... MsWord tells me I can't do mailmerge to email? ...
    (microsoft.public.word.mailmerge.fields)
  • Re: report with lines
    ... Any advice on how to use GDI+ or where to start looking. ... But now I've changed the textbox in the report ...
    (microsoft.public.fox.programmer.exchange)
  • Re: msvcr71.dll ?
    ... > I also use IS from vfp9. ... > and IS3.5sp5 is running ok but doesn't install msvcr71.dll although it ...
    (microsoft.public.fox.programmer.exchange)
  • Re: report with lines
    ... Any advice on how to use GDI+ or where to start looking. ... But now I've changed the textbox in the report ...
    (microsoft.public.fox.programmer.exchange)
  • Re: ctrl+c / v and inputbox()
    ... > need in a separate .PRG, ... > MESSAGE "Removes the selection and places it onto the Clipboard" ...
    (microsoft.public.fox.programmer.exchange)