Results 1 to 2 of 2

Thread: Copying Entire Folder Structures

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2004
    Location
    Milwaukee, Wisconsin, USA
    Posts
    133

    Exclamation Copying Entire Folder Structures

    Is there a way to copy an entire folder and file structure from one drive to another through code?

    I'm trying to copy folders, sub-folders, and the files that these folders/sub-folders hold without having to do a bunch of loops.

    I'm doing this right now using the DIR function to find all folders and files but I'm looking for an easier way.

    Thanks in advance...
    Last edited by robbie; Apr 8th, 2006 at 08:56 AM.

  2. #2
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,728

    Re: Copying Entire Folder Structures

    You could use FileSystemObject's CopyFolder method for it.
    (If you don't want to use CreateObject, then add a reference to Microsoft Scripting Runtime.)
    VB Code:
    1. Dim fso As Object
    2. Set fso = CreateObject("Scripting.FileSystemObject")
    3. fso.CopyFolder "C:\SourceFolder", "D:\DestFolder"
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


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