Results 1 to 5 of 5

Thread: Check whether a file exist

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2001
    Posts
    57

    Post Check whether a file exist

    I'd like to check whether a file exist cos I want to Kill it and then call a function to write a file with the same path and name. My function cannot overwrite the file.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    VB Code:
    1. If Len(Dir$("C:\myFile.txt")) > 0 Then
    2.   MsgBox "File Exists!"
    3. Else
    4.   MsgBox "File Doesn't Exist!"
    5. End If
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    By the by, why can't you overwrite the file?

    VB Code:
    1. Open "file.txt" For Output As #1
    2. ...

    that destroys the existing data in the file and replaces it with the new data...
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4

  5. #5
    New Member
    Join Date
    Jun 2001
    Location
    India
    Posts
    3
    Create a file system object and use it's exist function for checking file exist or not. It is 10 times faster then dir .
    For further contact [email protected]
    NitinGupta

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width