Home > Language Reference > System Functions > ExistDir

ExistDir

The ExistDir function checks for the existence of the specified folder.

Usage

Before processing actions on a folder, it is a good practise to test first if the folder exists. You will not get an error if in some circumstances, the folder does not exist.

Syntax

ret=ExistDir(<foldername>)

Parameters

<foldername>, string, name of the folder to test. A path can be included in <foldername>.

Return value

ret, integer. If <foldername> exists, the return value is 1. If not, the return value is 0. If the path specified in <foldername> is not valid, the return value is 0. If <directoryname> is in fact a filename, the return value is 0. 

See also

MkDir
RmDir
ChDir
CurDir$

Examples

ret=ExistDir(WinDir$()) 
msgbox(ret)

ret=ExistDir("C:\program files\wintas")
msgbox(ret)