IsDir

IsDir

Tests for the existence of directories

Syntax

      IsDir( <cDirName> ) --> <lIsDirectory>

Arguments

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

Return

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

Description

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

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

Note

IsDir() is name abreviated version of IsDirectory()

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

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

Seealso

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

HB_FNameExists

HB_FNameExists

Tests for the existence of a file or a directory

Syntax

      File( <cFileSpec> ) --> lExists

Argument

<cFileSpec> : Exact file name to find

Returns

<lExists> : true (.T.) if the file exists or logical false (.F.)

Description

This function return a logical true (.T.) if the given filename <cFileSpec> exist

Note

HB_FNameExists() 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_FNameExists( 'C:\' )                        //  .T.
      ? HB_FNameExists( 'C:\*.*' )                     //  .F.
      ? HB_FNameExists( 'C:\temp\*.*' )                //  .F.
      ? HB_FNameExists( 'C:\temp\*.' )                 //  .F.
      ? HB_FNameExists( 'C:\temp\test*.*' )            //  .F.
      ? HB_FNameExists( 'C:\temp\test.bat' )           //  .T.
      ? HB_FNameExists( 'C:\temp\Dir' )                //  .F.
      ? HB_FNameExists( 'C:\temp\Dir*.*' )             //  .F.
      ? HB_FNameExists( 'C:\temp\Dir1' )               //  .T.
      ? HB_FNameExists( 'C:\temp\Dir1*' )              //  .F.
      ? HB_FNameExists( 'C:\temp\Dir2' )               //  .T.
      ? HB_FNameExists( 'C:\temp\Dir2*' )              //  .F.
      ? HB_FNameExists( 'C:\temp\Dir1\test1.*' )       //  .F.
      ? HB_FNameExists( 'C:\temp\Dir1\test1.bat' )     //  .T.
      ? HB_FNameExists( 'C:\temp\Dir1\*.bat' )         //  .F.

File

Library is rtl

Seealso:

SET DEFAULT, SET PATH, SET(), Directory(), File(), IsDirectory(), IsDir(), HB_FileExists(), HB_DirExists()

HB_FileExists

HB_FileExists

Tests for the existence of a file

Syntax

      HB_FileExists( <cFileSpec> ) --> <lExist>

Arguments

<cFileSpec> : A character string holding the relative or absolute name of a file

Return

<lFileExist> : .T. (true) when the file <cFileSpec> exists, otherwise .F. (false) is returned.

Description

The HB_FileExists() function is used to check if a file exists that matches the specification <lFileExist>.

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

Note

HB_FileExists() is a Harbour level function to check for the existence of a file. This works better than FILE() in most situations, but it doesn’t accept any wildcards.

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_FileExists( 'C:\' )                        //  .F.
      ? HB_FileExists( 'C:\*.*' )                     //  .F.
      ? HB_FileExists( 'C:\temp\*.*' )                //  .F.
      ? HB_FileExists( 'C:\temp\*.' )                 //  .F.
      ? HB_FileExists( 'C:\temp\test*.*' )            //  .F.
      ? HB_FileExists( 'C:\temp\test.bat' )           //  .T.
      ? HB_FileExists( 'C:\temp\Dir' )                //  .F.
      ? HB_FileExists( 'C:\temp\Dir*.*' )             //  .F.
      ? HB_FileExists( 'C:\temp\Dir1' )               //  .F.
      ? HB_FileExists( 'C:\temp\Dir1*' )              //  .F.
      ? HB_FileExists( 'C:\temp\Dir2' )               //  .F.
      ? HB_FileExists( 'C:\temp\Dir2*' )              //  .F.
      ? HB_FileExists( 'C:\temp\Dir1\test1.*' )       //  .F.
      ? HB_FileExists( 'C:\temp\Dir1\test1.bat' )     //  .T.
      ? HB_FileExists( 'C:\temp\Dir1\*.bat' )         //  .F.

Seealso

SET DEFAULT, SET PATH, SET(), Directory(), File(),  IsDirectory(), IsDir(), HB_FNameExists(), HB_DirExists()

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()

File()

File

Tests for the existence of file(s)

Syntax

      File( <cFileSpec> ) --> lExists

Argument

<cFileSpec> DOS skeleton (mask) or file name to find

Returns

<lExists> : true (.T.) if the file exists or logical false (.F.)

Description

This function return a logical true (.T.) if the given filename <cFileSpec> exist. DOS skeletons symbols may be used in the filename in <cFileSpec>, as may the drive and/or path name. If a path is not explicitly specified, File() will look for the file in the SET DEFAULT path, then in each SET PATH path, until the file is found or there are no more paths to search. The DOS PATH is never searched and the current drive/directory is only searched if SET DEFAULT is blank.

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

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

Compliance

Cl*pper v5.2

File

Library is rtl

See also:

SET DEFAULT, SET PATH, SET(), IsDirectory(), IsDir(), HB_FileExists(), HB_FNameExists(), HB_DirExists()