Results 1 to 5 of 5

Thread: Copying an entire directory (sub-dirs and all files also) to C:\Program Files\TBW

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    103
    I want to copy a directory... we'll call it c:\tbw and all it's files and subdirectories and their files to C:\Program Files\TBW

    What is the easiest way to do this?

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    I'll call mine A and you change the names to yours
    Code:
    'copy the contents of a floppy to a folder on a different drive
    'copies files and folders seperately as they use different vehicles
    '
    
    Public Sub CopyA() 
        Dim FSO As Object 
        On Error GoTo NOFSO 
        Set FSO = CreateObject("Scripting.FileSystemObject") 
    
        On Error Resume Next 
        FSO.CopyFile "A:\*", "C:\My Documents\", True 
        FSO.CopyFolder "A:\*", "C:\My Documents\", True 
        Set FSO = Nothing 
        Exit Sub 
    NOFSO: 
        MsgBox "FSO CreateObject Failed" 
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    103
    Nope... this gives an error during the copying of the folders.

  4. #4
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Are any of your files open in the copied directory? I just tried HeSaidJoe's code and it worked fine.
    Chemically Formulated As:
    Dr. Nitro

  5. #5
    Lively Member
    Join Date
    Apr 2000
    Posts
    110

    Take Caution

    Take care when moving folders about using the FSO. It is very powerful. I 'accidently' screwed my PC over and had to reformat after moving all folders in C:\ into a new folder in C:\... it's a long story. Anyway, be careful dude

    Laterz

    REM
    "Innovate, don't immitate."

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