Results 1 to 4 of 4

Thread: How to Copy a Folder and its contents

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    32

    How to Copy a Folder and its contents

    hi ,

    i am trying to copy a folder which contains text file from one folder to the other like below but not sure how. I have tried the filecopy but that just copies file and the size of txt files in myfolder can increase and decrease can any one help!


    MyFolder--1.txt,2.txt3.txt....etc



    mynew folder -- Myfolder

  2. #2
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    Try something like this :

    VB Code:
    1. Private Sub cmdGo_Click()
    2. Dim fso As FileSystemObject
    3. Dim target_folder As Folder
    4.  
    5.     ' Copy the folder.
    6.     Set fso = New FileSystemObject
    7.     fso.CopyFolder txtCopyFrom.Text, _
    8.         txtCopyTo.Text, _
    9.         (chkOverwriteFiles.Value = vbChecked)
    10.     MsgBox "Ok"
    11. End Sub

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    32

    re

    thanks it worked a treat!!!!

  4. #4
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    Happy to help

    p.s. Can you edit your post and put [RESOLVED] in the heading.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width