HB_FileMatch

HB_FileMatch

Makes a DOS style file mask comparison

Syntax

      HB_FileMatch( <cFile>, <cPattern> ) -> <lMatch>

Argument

<cFile> : File name to compare

<cPattern> : File mask; file specification including wildcard characters ( *, ? )

Returns

<lMatch> : .T. if <cFile> matche with <cPattern>, else .F:

Description

This func makes a DOS style widcard comparison between given filename and mask (skeleton).

BTW HB_DirScan() uses internally HB_FileMatch().

Example

      LOCAL cTestFName := "C:\temp\test.tmp"

        ? 'File  ', FILE( cTestFName )                   // .T.
        ? 'C     ', HB_FileMatch( cTestFName, 'C' )      // .F.
        ? ':     ', HB_FileMatch( cTestFName, ':' )      // .F.
        ? 'C:    ', HB_FileMatch( cTestFName, 'C:' )     // .F.
        ? 'temp  ', HB_FileMatch( cTestFName, 'temp' )   // .F.
        ? '*temp ', HB_FileMatch( cTestFName, '*temp' )  // .F.
        ? '*temp*', HB_FileMatch( cTestFName, '*temp*' ) // .T.
        ? 'test  ', HB_FileMatch( cTestFName, 'test' )   // .F.
        ? '.tmp  ', HB_FileMatch( cTestFName, '.tmp' )   // .F.
        ? '*tmp  ', HB_FileMatch( cTestFName, '*tmp' )   // .T.

Seealso

HB_DirScan(), FileSeek(), Directory()

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s