Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleUse a FileSystemObject to copy a folder hierarchy
DescriptionThis example shows how to use a FileSystemObject to copy a folder hierarchy in Visual Basic 6. It uses the object's CopyFolder method.
KeywordsFileSystemObject, File System Object, FSO, CopyFolder, copy folder, folder, hierarchy, copy directory
CategoriesFiles and Directories
 
The program contains a reference to the Microsoft Scripting Runtime.

It creates an instance of the FileSystemObject and uses its CopyFolder method to copy a directory to a new location.

 
Private Sub cmdGo_Click()
Dim fso As FileSystemObject
Dim target_folder As Folder

    ' Copy the folder.
    Set fso = New FileSystemObject
    fso.CopyFolder txtCopyFrom.Text, _
        txtCopyTo.Text, _
        (chkOverwriteFiles.Value = vbChecked)
    MsgBox "Ok"
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated