good evening,
I must be sure that a directory has been created.
Is there a command to search like if (if the path exists) then (if the path does not exist) endif ? ?
Thanks always
Aurora Baccio
Hope this can help
John
FUNCT IsDir( cDirectory AS STRING ) AS LOGIC
LOCAL lRetVal := TRUE AS LOGIC
LOCAL StruData IS _WINWIN32_FIND_DATA
LOCAL nHandle AS PTR
DO CASE
CASE Empty(cDirectory)
lRetVal := FALSE
CASE ! SubStr(cDirectory,2,2) == ':\'
* see if you want full path or not
CASE IsDriveReady(Left(cDirectory,2))
* the drive of the path is not ready
OTHERWISE
lRetVal := FALSE
ENDCASE
*
* check dir on the drive
IF lRetVal
IF !( Right( cDirectory, 1 ) == "\" )
cDirectory += "\"
ENDIF
nHandle := FindFirstFile( String2Psz( cDirectory+'*.*' ), @StruData )
IF nHandle = INVALID_HANDLE_VALUE
lRetVal := FALSE
ELSE
CloseHandle( nHandle )
lRetVal := TRUE
ENDIF
ENDIF
RETURN lRetVal
Op 23-2-2021 om 17:38 schreef aurora baccio:
good evening,
I must be sure that a directory has been created.
Is there a command to search like if (if the path exists) then (if the path does not exist) endif ? ?
Thanks always
Aurora Baccio
Hope this can help
John
FUNCT IsDir( cDirectory AS STRING ) AS LOGIC
LOCAL lRetVal := TRUE AS LOGIC
LOCAL StruData IS _WINWIN32_FIND_DATA
LOCAL nHandle AS PTR
DO CASE
CASE Empty(cDirectory)
lRetVal := FALSE
CASE ! SubStr(cDirectory,2,2) == ':\'
* see if you want full path or not
CASE IsDriveReady(Left(cDirectory,2))
* the drive of the path is not ready
OTHERWISE
lRetVal := FALSE
ENDCASE
*
* check dir on the drive
IF lRetVal
IF !( Right( cDirectory, 1 ) == "\" )
cDirectory += "\"
ENDIF
nHandle := FindFirstFile( String2Psz( cDirectory+'*.*' ), @StruData
) IF nHandle = INVALID_HANDLE_VALUE
lRetVal := FALSE
ELSE
CloseHandle( nHandle )
lRetVal := TRUE
ENDIF
ENDIF
RETURN lRetVal
Op 23-2-2021 om 17:38 schreef aurora baccio:
good evening,
I must be sure that a directory has been created.
Is there a command to search like if (if the path exists) then (if
the path does not exist) endif ? ? Thanks always
Aurora Baccio
Function isPath(cPath)
RETURN ALen(Directory(cPath + "*.*"," D")) > 0
Fred
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 293 |
Nodes: | 16 (2 / 14) |
Uptime: | 242:28:48 |
Calls: | 6,624 |
Files: | 12,175 |
Messages: | 5,320,202 |