Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Check for File Presence

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,504
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Check for File Presence
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Check for File Presence - 11/28/2001 7:33:59 AM   
  yardbird52

 

Posts: 1
Score: 0
Joined: 11/28/2001
From: USA
Status: offline
In VBScript is it possible to check for the presence of a particular file? I would like to do this and if it is not present, create it within my code. None of the documentation I have indicate how to do this.

Thanks
 
 
Post #: 1
 
 Re: Check for File Presence - 11/28/2001 4:09:07 PM   
  imav8n

 

Posts: 95
Score: 0
Joined: 7/3/2001
From: USA
Status: offline
There is a method called FileExists (there's also DriveExists, etc...) that you can use for just that purpose.

Here is a code example I copied off of www.devguru.com:

<%
dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
filesys.CreateTextFile "c:\somefile.txt", True
If filesys.FileExists("c:\somefile.txt") Then
filesys.DeleteFile "c:\somefile.txt"
Response.Write("File deleted")
End If
%>

Good Luck!

~imav8n
Failure is not an option.....it comes bundled with the software.

(in reply to yardbird52)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Check for File Presence Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts