Task

Verify that a file called     input.txt     and   a directory called     docs     exist.



This should be done twice:  

   once for the current working directory,   and
   once for a file and a directory in the filesystem root.


Optional criteria (May 2015):   verify it works with:

   zero-length files
   an unusual filename:     `Abdu'l-Bahá.txt  


Set FSO = CreateObject("Scripting.FileSystemObject")
 
Function FileExists(strFile)
    If FSO.FileExists(strFile) Then
        FileExists = True
    Else
        FileExists = False
    End If
End Function
 
Function FolderExists(strFolder)
    If FSO.FolderExists(strFolder) Then
        FolderExists = True
    Else
        Folderexists = False
    End If
End Function
 
'''''Usage (apostrophes indicate comments-this section will not be run)'''''
'If FileExists("C:\test.txt") Then
'   MsgBox "It Exists!"
'Else
'   Msgbox "awww"
'End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
'Shorter version
 
If CreateObject("Scripting.FileSystemObject").FileExists("d:\test.txt") Then
    Wscript.Echo "File Exists"
Else
    Wscript.Echo "File Does Not Exist")
End If
 
 
 