PDA

Click to See Complete Forum and Search --> : Copying Multiple Files


Milleniux
Jan 9th, 2000, 08:50 PM
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.

Mark Sreeves
Jan 9th, 2000, 09:56 PM
use filecopy and loop through a list (or array) of files you want to copy

Aaron Young
Jan 9th, 2000, 10:54 PM
You can also use the FileSystemObject which means you'd have to include the Scripting Runtime DLL with your App, ie.

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
aarony@redwingsoftware.com
ajyoung@pressenter.com