Hi all,

As i mentioned in thread title, i want to create and delete folder.
How i can create and delete folder/directory with vb6.

Please help
Regard

Recommended Answers

Try :

Private Sub Command1_Click()
If Dir$("D:\Daniweb\", vbDirectory) = "" Then
    MkDir "D:\Daniweb\"
Else
    MsgBox "Duplicate Folder"
End If
End Sub

Private Sub Command2_Click()
If Dir$("D:\Daniweb\", vbDirectory) = "" Then
    MsgBox "Folder not found"
Else
    RmDir "D:\Daniweb\"
End If
End Sub
Jump to Post

All 2 Replies

Re: Create and Delete Folder 80 80

Try :

Private Sub Command1_Click()
If Dir$("D:\Daniweb\", vbDirectory) = "" Then
    MkDir "D:\Daniweb\"
Else
    MsgBox "Duplicate Folder"
End If
End Sub

Private Sub Command2_Click()
If Dir$("D:\Daniweb\", vbDirectory) = "" Then
    MsgBox "Folder not found"
Else
    RmDir "D:\Daniweb\"
End If
End Sub
commented: Help me too +0
Re: Create and Delete Folder 80 80

try this

Dim fso As New FileSystemObject

now code to create a folder

fso.CreateFolder "d:\newfolder"

and now code to delete a folder

fso.DeleteFolder "d:\newfolder"

before putting this code first add references and so goto project menu and then select references option and then select Microsoft Scripting Runtime

hope this helps you . . .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.