FUNCTIONS CORE

IsDir()

Test whether a name or a mask finds a directory

Syntax

Signature
IsDir( cDirSpec ) --> lIsDirectory

Arguments

cDirSpec

A directory name, or a mask with * and ?.

Return value

.T. when the first entry found is a directory, otherwise .F.

Description

IsDir() is the same function as IsDirectory(). See there.

Example

IsDir.prg
PROCEDURE Main()

   DirMake( "isdir-demo" )
   MemoWrit( "isdir-file.txt", "text", .F. )

   Check( 'IsDir() of a directory           ', IsDir( "isdir-demo" ), .T. )
   Check( 'IsDir() of a file                ', IsDir( "isdir-file.txt" ), .F. )

   FErase( "isdir-file.txt" )
   DirRemove( "isdir-demo" )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

   QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN

Output

IsDir() of a directory           OK
IsDir() of a file                OK

See also