Results 1 to 3 of 3

Thread: Copying Multiple Files

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Location
    Liskeard, cornwall
    Posts
    21

    Post

    Please could someone help

    I want my program to be able to copy Multiple files from one directory to another.

    E.G "copy c:\test\*.txt c:\test2\"

    However, I cannot seem to find a command to fulfil this task. I know about "Filecopy" in VB, but that only allows one file at a time copying. I even tried shelling to copy, but it just doesnt do anything.

    E.G b=shell("copy "+param1+" "+param2)

    I am using VB5(SP3). Please could someone help.

    Cheers

    M.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    use filecopy and loop through a list (or array) of files you want to copy

  3. #3
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    You can also use the FileSystemObject which means you'd have to include the Scripting Runtime DLL with your App, ie.
    Code:
    Private Sub Command1_Click()
        Dim oFSO As Object
        Set oFSO = CreateObject("Scripting.FileSystemObject")
        Call oFSO.copyfile("C:\Test\*.txt", "C:\Test2")
        Set oFSO = Nothing
    End Sub

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


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