VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Copy a Folder

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

Rate Copy a Folder

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

Download this snippet    Add to My Saved Code

Copy a Folder Comments

No comments have been posted about Copy a Folder. Why not be the first to post a comment about Copy a Folder.

Post your comment

Subject:
Message:
0/1000 characters