by Manuel W. (3 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)
Copy a Folder in another Folder. If the Folder not exists then this program will create the Folder.
Assumes
1 Form, 1 Commandbutton
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:\win98\config"
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