>Hi all,
>
>The problem is simple: If I have a stored path, something like:
>lcPath = 'C:\thisfolderdoesnotexist\nowhere'
>
>I'd like to check if the past exists or not.
>
>I checked functions included in FOXTOOLS.FLL and nothing really did the job. I don't think VFP 6 has a function for this yet, and I'm using VFP 5 for this project. I've been suggested to use arrays, etc.
>
>But before I start jack-hammering keys like crazy, wanted to do a check first.
>
>:(
>
>What do u propose to verify for its validity?
>
There are a couple of approaches you can take here. You can use ADIR() with the "D" for an attribute specifier; it works in most all cases except where there's more than one "." in one section of a folder name.
If you need to know if a folder is writable, try to create a file using FCREATE(), and trap the error if it occurs:
FUNCTION IsWritable
LPARAMETER cDirTOCheck
LOCAL cErrorRtn, cTempFileName, cPathTOCheck, lSuccess, nFH
cPathToCheck = ALLTRIM(cDirToCheck)
IF RIGHT(cPathToCheck,1) # '\'
cpathToCheck = cpathToCheck + '\'
ENDIF
cTempFilename = SYS(3)
DO WHILE FILE(cPathToCheck + cTempFileName)
cTempFileName = SYS(3)
ENDDO
cErrorRtn = ON('ERROR')
lSuccess = .T.
ON ERROR lSuccess = .F.
nFH = FCREATE(cPathToCheck + cTempFileName)
ON ERROR &cErrorRtn
IF lSuccess
=FCLOSE(nFH)
ERASE (cPathToCheck + cTempFileName)
ENDIF
RETURN lSuccess