Check that file exists: Difference between revisions

m
→‎{{header|VBScript}}: indentation - but these If/Then are totally useless, and so are these functions: calling FSO.FileExists(name) is equivalent to this FileExists(name)
m (→‎{{header|VBScript}}: indentation - but these If/Then are totally useless, and so are these functions: calling FSO.FileExists(name) is equivalent to this FileExists(name))
Line 2,220:
=={{header|VBScript}}==
 
<lang vbscript>Set FSO = CreateObject("Scripting.FileSystemObject")
 
Function FileExists(strFile)
if If FSO.fileExistsFileExists(strFile) thenThen
FileExists =true True
Else
else
FileExists =false False
End If
end if
End Function
end function
 
Function folderExistsFolderExists(strFolder)
if If FSO.folderExistsFolderExists(strFolder) thenThen
FolderExists = True
folderExists=true
Else
else
Folderexists = False
folderexists=false
End If
end if
End Function
end function
 
'''''usageUsage (apostrophes indicate comments-this section will not be run)'''''
'ifIf fileExistsFileExists("C:\test.txt") thenThen
'msgbox MsgBox "It Exists!"
'Else
'else
'msgbox Msgbox "awww"
'endEnd ifIf
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
 
'ShortestShorter version
 
If CreateObject("Scripting.FileSystemObject").FileExists("d:\test.txt") Then
1,336

edits