File_DirExists()

Parent Previous Next

File_DirExists(pFileName), Bit


pFileName: The name of the directory to check (maximum length 8 characters).


Return Status:

0: Directory not found.

1: Directory found.


Check if Directory Exists


This procedure checks whether a directory with the given name exists. The directory name can be up to 8 characters in length.


Notes:

• Before checking for other files or folders, ensure that any previously opened files are closed using File_Close().


Example:

File_DirExists("MyFolder")


TftSetUp(0)                                                                                 'Set screen

TftResetScreen(BLACK)                                                                       'Reset screen

TftSetSndFont(0,0)                                                                          'Set Font0

While File_Init() <> cErrOK : Wend                                                          'Initialize SD Card

TftPrintSndString("Sd Initialization OK",1,0,0,1,GREEN,BLACK,0)                             'Confirm Initialize SD Card

If File_Exists("bird.jpg") = 1 Then

    TftPrintSndString("Exist bird.jpg OK",1,0,4,1,GREEN,BLACK,0)                            'bird.jpg exists (expected)

Else

    TftPrintSndString("Exist bird.jpg NO",1,0,4,1,GREEN,BLACK,0)                            'bird.jpg not exists

EndIf

If File_Exists("test.log") = 1 Then

    TftPrintSndString("Exist test.Log OK",1,0,5,1,GREEN,BLACK,0)                            'test.Log exists 

Else

    TftPrintSndString("Exist test.Log NO",1,0,5,1,GREEN,BLACK,0)                            'test.Log not exists (expected)

EndIf

If File_DirExists("home") = 1 Then

    TftPrintSndString("Exist home OK",1,0,2,1,GREEN,BLACK,0)                                'home folder exists (expected)

Else

    TftPrintSndString("Exist home NO",1,0,2,1,GREEN,BLACK,0)                                'home folder not exists

EndIf

If File_DirExists("tree") = 1 Then

    TftPrintSndString("Exist tree OK",1,0,3,1,GREEN,BLACK,0)                                'tree folder exists

Else

    TftPrintSndString("Exist tree NO",1,0,3,1,GREEN,BLACK,0)                                'tree folder not exists (expected)

EndIf






Created with the Personal Edition of HelpNDoc: Effortlessly upgrade your WinHelp HLP help files to CHM with HelpNDoc