Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I check if a file exists?

Status
Not open for further replies.

BigDudley

Programmer
Jun 29, 2000
2
US
I am trying to do a simple check of whether or not a file exists in VB Script.&nbsp;&nbsp;My attempts have failed because of the limited functionality of VB Script vs. Visual Basic.<br>I need help.
 
To check if a file exists or not use FileExists from the FileSystemObject of VBS. It returns a boolean result indicating whether the requested file is there or not. See the example below.<br><br>&nbsp;Set FSys = CreateObject(&quot;Scripting.FileSystemObject&quot;)<br>&nbsp;if Not FSys.FileExists(&quot;C:\Filename.txt&quot;) Then<br>&nbsp;&nbsp;&nbsp;...<br><br>You may also be interested in the VBS documentation, available to download as an exe from the Microsoft site. Its called vbsdoc.exe and has a good tutorial on the FileSystem Object.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top