CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2003
    Location
    India
    Posts
    68

    How To Find Whether A Folder Exists or Not?

    Hello Gurus...

    I think this is a silly question for u.. but it is eatingmy brain

    How to check whether a folder is exists or not in another folder

    If it returns "No" then how toi create it?


    I was done this job once using " Scripting.Filesystemobject"
    But now i am unable to get it

    Please Explain it in " Scripting.Filesystemobject"...or u can take any other
    Thanks In Advance
    Mind is like Parachute...It functions when it is open

  2. #2
    Join Date
    Aug 2003
    Location
    Buenos Aires, Argentina
    Posts
    513
    Include Microsoft Scripting Runtime in Project-->References

    In your form:
    Dim FsObj As FileSystemObject
    Set FsObj = New FileSystemObject
    MsgBox FsObj.FolderExists("C:\")

  3. #3
    Join Date
    Aug 2003
    Location
    Singapore
    Posts
    34

    Lightbulb May i suggest

    May be U want to try using VB w/o FSO?
    Just Plain DIR() function
    U can use any other folder to test this function?
    Code:
    Dim sDir As String
    sDir = "C:\windows\" 'folder must end with a slash 
    If Dir(sDir) <> "" Then
    MsgBox "Folder Exist!"
    Else
    MsgBox "Folder Does Not Exist!"
    End If
    I May Have Misinterpret U'r Post
    Correct Me If I Am Wrong.........//
    Enjoy Coding............................//


    zak2zak

  4. #4
    Join Date
    Feb 2001
    Location
    PA
    Posts
    163
    'Microsoft Scripting Runtime

    Dim fso As FileSystemObject
    Set fso = New FileSystemObject

    If Not fso.FolderExists("Path") Then fso.CreateFolder("Path")

  5. #5
    Join Date
    Feb 2003
    Location
    AR
    Posts
    228
    Windows 98 initially does not include the Windows Scripting Host component.

    How can I create a folder using VB instrucions rather than the fso?

    Since I don't work for Microsoft, I don't want to force the user to install Internet Explorer 6.0 SP8 with MSN Messenger 15.5 nor the latest 800 critical system updates to get a stupid file. Nor copy it manually.

    I hate when I start any app in a fresh windows 98 install and NOTHING works. So from now on I avoid the Windows Common Controls, Windows Script host and other new components.

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