PDA

Click to See Complete Forum and Search --> : CopyFile from a:\*.* to c:\*.*


Sheley
Jul 11th, 1999, 12:02 PM
Hi there..

What is the code for diskcopy all files from one selected drive to and other selected drive... for example copy everything from drive A to drive C root directory....?

I try to use the following code in VB6 and I have (div1, drive1 and file1) in my form.

copyfile "a:\*.*", "c:\*.*"

and what is File System Object?

Thank You

Sheley

Serge
Jul 11th, 1999, 03:32 PM
Files System Object is a DLL (Scripting runtime library) by Microsoft.

Yes, it supports what you ask, copying one directory into another, but then you will have to include this DLL along with your project. There's a VB way to do just that:


Public Sub CopyFromFloppy()
Dim strFile As String
Dim strDestFile As String


strFile = Dir("A:\*.*")

Do Until strFile = ""
strDestFile = "C:\" & ParseFile(strFile)
FileCopy "A:\" & strFile, strDestFile
strFile = Dir
Loop
End Sub

Public Function ParseFile(pFileName As
String) As String

Do
pFile = Mid$(strFileName, InStr(pFileName, "\") + 1)
Loop While InStr(pFileName, "\") <> 0

ParseFile = pFileName

End Function



Regards,


------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com