CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 1999
    Location
    California
    Posts
    264

    How can I know if a file or a directory exists or not?

    How can I know if a file or a directory exists or not?

    Thank you!

    Best Regards,

    Kevin Shen
    Best Regards,

    Kevin Shen

  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: How can I know if a file or a directory exists or not?

    refer
    http://vblib.virtualave.net

    there is a function call IsFileExist in vbFileIO class.

    from there, you would probably find out how to crate your own function to check the directory existance.

    hope this help.


  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: How can I know if a file or a directory exists or not?

    An easiest way -provided you know what you are looking for- is the following:
    if dir("myfile.exe")<>"" then... 'the file exists, or there is a directory with same name as file
    if dir("mydir",vbdirectory)<>"" then... 'a directory exists

    Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

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

Featured