Copy a Folder
![Visual Basic 6, or VB Classic Visual Basic 6, or VB Classic](https://www.fortypoundhead.com//assets/img/icons/v7/vb6.png)
Copy a Folder in another Folder. If the Folder not exists then this program will create the Folder.
Original Author: Manuel W.
Assumptions
1 Form, 1 Commandbutton
Code
Private Sub Command1_Click()
On Error Resume Next
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.createfolder("c:windowscopy")
' For Example:
path1$ = "c:win98config"
path2$ = "c:windowscopy"
If fso.folderexists(path1$) Then
If Not fso.folderexists("c:windowscopy") Then
'Generate Path
Set fld = fso.createfolder("c:windowscopy")
End If
'Copy now
fso.copyfolder path1$, path2$, True
'On Error:
Else
MsgBox "Verzeichnis konnte nicht kopiert werden!"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set fso = Nothing
End Sub
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.