RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB5,VB6,VBS
Expertise: beginner
Aug 23, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Copy a directory tree

Creating a VB routine that copies a whole directory tree can be a time-consuming job, but fortunately you don't have to do it. In fact, you can quickly create an entire folder, including all its subfolders, using the CopyFolder method of the FileSystemObject object, that is exposed by the Microsoft Scripting Runtime type library.

' copy the entire contents of the C:\DOCS directory into the
' C:\BACKUP\DOCS directory, overriding existing files.
' This code assumes that you added a reference to the 
' Microsoft Scripting Runtime type library

Dim fso As New Scripting.FileSystemObject
fso.CopyFolder "c:\docs", "c:\backup\docs", True
If you pass False to the 3rd argument (or omit it), the CopyFolder method doesn't copy files that already exist in the destination folder.
Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date