Check for existence of a file? 
Author Message
 Check for existence of a file?

Can someone tell me how to do a simple check to see if a file exists on
disk?  I'm just looking for something similar to an "IF EXIST" statement in
DOS batch programming.  The "Tools.FileExists" statement looked promising at
first, but it turns out to be limited to URLs only.  I would guess there
must be an easy way to do this that I'm just overlooking.

Any help is appreciated,
Ralph



Wed, 11 Jul 2001 03:00:00 GMT  
 Check for existence of a file?
On Sat, 23 Jan 1999 23:00:14 -0500, "R. Abraham"

Quote:

>Can someone tell me how to do a simple check to see if a file exists on
>disk?  I'm just looking for something similar to an "IF EXIST" statement in
>DOS batch programming.  The "Tools.FileExists" statement looked promising at
>first, but it turns out to be limited to URLs only.  I would guess there
>must be an easy way to do this that I'm just overlooking.

>Any help is appreciated,
>Ralph


Public Function FileExists(FileName As String) As Boolean
        FileExists = True
        On Error Resume Next
        Open FileName for Input As #1
        If Err Then FileExists = False
End Function

HTH,
Ed Phillippe

****************************************
NOTICE TO BULK EMAILER(S):
Pursuant to US Code, Title 47, Chapter
5, Subchapter II, 227, any & all
unsolicited commercial e-mail sent to
this address is subject to a download
and archival fee in the amount of
$500 US and copies will be forwarded
to domain administrators--E-mailing
denotes acceptance of said terms!

BUT, just in case you do SPAM this:





****************************************



Thu, 12 Jul 2001 03:00:00 GMT  
 Check for existence of a file?
Kept searching and finally found it.

Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(" path & filename here ") Then
  Yada, Yada, Yada. . .

Thanks



Thu, 12 Jul 2001 03:00:00 GMT  
 Check for existence of a file?
Use the Dir function.

Stimpson

Quote:

>Can someone tell me how to do a simple check to see if a file exists on
>disk?  I'm just looking for something similar to an "IF EXIST" statement in
>DOS batch programming.  The "Tools.FileExists" statement looked promising
at
>first, but it turns out to be limited to URLs only.  I would guess there
>must be an easy way to do this that I'm just overlooking.

>Any help is appreciated,
>Ralph




Thu, 12 Jul 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How to check for existence of a file on harddisk form OL VBscript

2. Checking for existence of a file???

3. Checking for existence of a file...

4. Checking the Existence of a File

5. A2K Check for Existence of Back End File

6. Checking for the existence of a file

7. Check File Existence?

8. Checking for the Existence of a File

9. Checking for random file existence in Visual Basic

10. Check for the existence of a file.

11. Newbie Question: File existence checking

12. file existence check

 

 
Powered by phpBB® Forum Software