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

3 responses to “File()

  1. Pingback: Harbour All Functions – F | Viva Clipper !

  2. Pingback: Harbour Files and Folders Functions | Viva Clipper !

  3. Pingback: Harbour RG Summary | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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