AllExperts > Visual Basic 
Search      
Visual Basic
Volunteer
Answers to thousands of questions
 Home · More Visual Basic Questions · Answer Library  · Encyclopedia ·
More Visual Basic Answers
Question Library

Ask a question about Visual Basic
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About S.Aziz
Expertise
All questions related to vb6 only. Excuse me for vb.net.

Experience
12 years as a programmer.

Organizations
Print Media

Publications
Math Skill Test VB6 Game Source Code published at Planet-Source --------------------------------------------------------------- http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=72322&lngWId=1 Holy Quran Source Code published at Planet-Source ------------------------------------------------- http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=72343&txtForceRefresh=82020091635140766 Right to Left Treeview & Listview Source Code published at Planet-Source ------------------------------------------------------------------------ http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=72376&lngWId=1

Education/Credentials
Commerce Graduate ICWAI

Awards and Honors
Wizard certificate from experts-exchange.com ============================================= http://www.experts-exchange.com/M_1214708.html Level 4 certificate from Yahoo!Answers ======================================= http://answers.yahoo.com/my/my;_ylt=AkjObjoI7Cr1x01J9syQ5RZ17hR.;_ylv=3

 
   

You are here:  Experts > Computing/Technology > Basic > Visual Basic > Copying a folder to a location

Visual Basic - Copying a folder to a location


Expert: S.Aziz - 10/29/2009

Question
Hi,
I need your assistance on a code that will copy a specific folder from one location to another. e.g. copy a folder from D:\ to C:\

Thanks

Answer
Try with the following code :

Sub CopyFolder(folderpath As String, destfolderpath As String)
Dim fso As Object
Dim fld As Object
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set fld = fso.GetFolder(folderpath)
   fld.Copy destfolderpath
End Sub

You can call this routine like below
Call CopyFolder("D\MyFolder", "C:\")


Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.