• directory exists

    From JohnMartens@21:1/5 to All on Tue Feb 23 17:54:59 2021
    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


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aurora baccio@21:1/5 to All on Tue Feb 23 08:38:45 2021
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aurora baccio@21:1/5 to All on Tue Feb 23 10:06:42 2021
    Il giorno martedì 23 febbraio 2021 17:54:58 UTC+1, JohnMartens ha scritto:
    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


    thanks,it works
    Aurora Baccio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wolfgang Riedmann@21:1/5 to JohnMartens on Wed Feb 24 13:52:32 2021
    Or even easier:


    function IsDirectory( cFileName as string ) as logic
    local nReturn as dword

    if Right( cFileName, 1 ) == "\"
    cFileName := Left( cFileName, SLen( cFileName ) - 1 )
    endif
    nReturn := GetFileAttributes( String2Psz( cFileName ) )
    if nReturn == 0xFFFFFFFF
    return false
    endif

    return _And( nReturn, FILE_ATTRIBUTE_DIRECTORY ) ==
    FILE_ATTRIBUTE_DIRECTORY

    Wolfgang


    JohnMartens wrote:

    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




    --

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Fred Killet@21:1/5 to All on Thu Feb 25 17:47:49 2021
    Function isPath(cPath)
    RETURN ALen(Directory(cPath + "*.*"," D")) > 0

    Fred

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Fred Killet@21:1/5 to All on Sat Feb 27 09:45:15 2021
    Am 25.02.2021 um 17:47 schrieb Fred Killet:
    Function isPath(cPath)
    RETURN ALen(Directory(cPath + "*.*"," D")) > 0

    Fred


    Funktioniert unter VO28 mit und ohne abschließenden Backshlash. Die
    Funktion Directory() korrigiert den Path-String offensichtlich
    selbstständig.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)