Search Tools Links Login

Copy a Folder


Visual Basic 6, or VB Classic

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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 105 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.