Results 1 to 4 of 4

Thread: copy directory

  1. #1

    Thread Starter
    Lively Member Alessio's Avatar
    Join Date
    Feb 2002
    Location
    http://www.nottehorror.too.it
    Posts
    101

    copy directory

    how can I let for copying the whole content of a directory in another directory (and to create the new directory if it doesn't already exist)???

  2. #2
    Hyperactive Member CHAMPGARY's Avatar
    Join Date
    Jul 2002
    Posts
    386
    I think copy method ,
    I haven't use that but in MSDN it is specified, It copies a specified file or folder from one location to another.

    Syntax:

    object.Copy destination[, overwrite]

    object required is always the name of a File or Folder object. Overwrite is true/false


    Regards
    Gary

  3. #3
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    the object Gary talks about is the File System Object.

    Add a reference to the 'Microsoft Scripting Runtime' (scrrun.dll)
    then try this little sample

    VB Code:
    1. Private Sub Command3_Click()
    2.     Dim fso As New FileSystemObject
    3.     fso.CopyFolder "C:\Test", "C:\Test2"
    4. End Sub
    -= a peet post =-

  4. #4
    Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    52
    Another option is the File System Object.
    Check MSDN for it.

    Reference needed is Windows Scripting Runtime

    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.CopyFoder "path to folder", "destintation path", OverWirte (true/False)

    Use the FolderExists to check it's there first, CreateFolder if it isn't.

    DanAzz

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