Re: check if drive exist



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: After manually undoing a recent MS Update, my server is a mess
    ... Keep in mind that I have seen OEM drivers up there so given that you've blown that image away, I can't say for certain that the 'critical' was 100% pushed by Microsoft. ... External USB is no replacement for local drives. ... LOL I show my naivety here when I say that I showed great diligence in my blind application of any MS suggested resolution to "Critical Errors" on my Small Business Server Monitor Report. ... When I got the first BSOD, I booted from the orginal CD and chose to only restore the System files. ...
    (microsoft.public.windows.server.sbs)
  • Re: After manually undoing a recent MS Update, my server is a mess
    ... information to login to my server remotely to look around--hoping he could ... External USB is no replacement for local drives. ... stored on) and chose to only restore the System files. ... The "Cases" drive was actually a shared folder on an external ...
    (microsoft.public.windows.server.sbs)
  • Re: After manually undoing a recent MS Update, my server is a mess
    ... During the restore, the server rebooted without confirmation. ... The "Cases" drive was actually a shared folder on an external ... I mirrored the two drives ...
    (microsoft.public.windows.server.sbs)
  • Re: After manually undoing a recent MS Update, my server is a mess
    ... Before installing this server, my users were accustomed to storing all of ... The "Cases" drive was actually a shared folder on an external ... I mirrored the two drives ... Connection-specific DNS Suffix. ...
    (microsoft.public.windows.server.sbs)
  • Re: After manually undoing a recent MS Update, my server is a mess
    ... Before installing this server, my users were accustomed to storing all of their files on what they call the "Cases" drive. ... Wrong...Windows XP didn't have the necessary drivers to mount the broken half-mirror dynamic drive and I was told that because the server was 64 bit, the 32 bit drivers probably wouldn't even help. ... Connection-specific DNS Suffix. ... I asked him how it could get 3/4 of the way through the boot process, obviously reading files from the drives, before BSOD and he suggested that perhaps a patch was incompatible with my hardware. ...
    (microsoft.public.windows.server.sbs)

Loading