HB_DirExists

HB_DirExists

Tests for the existence of a directory

Syntax

      HB_DirExists( <cDirName> ) --> <lIsDirectory>

Arguments

<cDirName> : A character string holding the relative or absolute name of a directory.

Return

<lIsDirectory> : .T. (true) when the directory <cDirName> exists, otherwise .F. (false) is returned.

Description

The HB_DirExists() function is used to check if a directory exists that matches the specification <cDirName>.

This is a character string containing the absolute or relative path of a directory.

Note

HB_DirExists() don’t accept wildcard characters

Example

      Assuming this directory tree and files exist :

      C:\
         | temp                     D
         + ---- + Dir1              D
                |      doc1.docx    F
                |      test1.bat    F
                |      test1.txt    F
                + Dir2              D
                       doc2.docx    F
                       test2.bat    F
                       test2.txt    F

      ? HB_DirExists( 'C:\' )                        //  .T.
      ? HB_DirExists( 'C:\*.*' )                     //  .F.
      ? HB_DirExists( 'C:\temp\*.*' )                //  .F.
      ? HB_DirExists( 'C:\temp\*.' )                 //  .F.
      ? HB_DirExists( 'C:\temp\test*.*' )            //  .F.
      ? HB_DirExists( 'C:\temp\test.bat' )           //  .F.
      ? HB_DirExists( 'C:\temp\Dir' )                //  .F.
      ? HB_DirExists( 'C:\temp\Dir*.*' )             //  .F.
      ? HB_DirExists( 'C:\temp\Dir1' )               //  .T.
      ? HB_DirExists( 'C:\temp\Dir1*' )              //  .F.
      ? HB_DirExists( 'C:\temp\Dir2' )               //  .T.
      ? HB_DirExists( 'C:\temp\Dir2*' )              //  .F.
      ? HB_DirExists( 'C:\temp\Dir1\test1.*' )       //  .F.
      ? HB_DirExists( 'C:\temp\Dir1\test1.bat' )     //  .F.
      ? HB_DirExists( 'C:\temp\Dir1\*.bat' )         //  .F.

Seealso

Directory(), File(), IsDir(), IsDirectory(), HB_FileExists(), HB_FNameExists()

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.