Re: check if drive exist
- From: "Carsten Bonde" <bonde AT real-inkasso DOT de>
- Date: Mon, 9 May 2005 12:13:48 +0200
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
> --
>
>
.
- Follow-Ups:
- Re: check if drive exist
- From: christophe
- Re: check if drive exist
- From: christophe
- Re: check if drive exist
- References:
- check if drive exist
- From: christophe
- check if drive exist
- Prev by Date: Re: check if drive exist
- Next by Date: Re: check if drive exist
- Previous by thread: Re: check if drive exist
- Next by thread: Re: check if drive exist
- Index(es):
Relevant Pages
|
Loading