Below you'll find the source for the Visual Basic 6 function copy.
Attribute VB_Name = "modCopy"
' These functions are downloaded from:
' http://www.stefanthoolen.nl/archive/vb6-functions/
'
' You may freely distribute this file but please leave all comments, including this one, in it.
'
' @Author Stefan Thoolen <mail@stefanthoolen.nl>
Option Explicit
''
' This function checks if a file exists and returns true or false
' Same syntax as the PHP function 'file_exists'
' See also: http://www.php.net/manual/en/function.file-exists.php
' @param String filename The file to check for
' @return Boolean Wether the file exist or not
' @author Stefan Thoolen <mail@stefanthoolen.nl>
Public Function file_exists(filename) As Boolean
If Dir(filename, vbHidden Or vbReadOnly Or vbSystem Or vbArchive) <> "" Then file_exists = true
End Function
''
' This function copies a file
' Same syntax as the PHP function 'copy' except for the context-parameter
' See also: http://www.php.net/manual/en/function.copy.php
' Dependency: Scripting.FileSystemObject (.NET Framework 2.0)
' @param String source The source filename
' @param String dest The destination filename
' @return Boolean True on success, false otherwise
' @author Stefan Thoolen <mail@stefanthoolen.nl>
Public Function copy(source As String, dest As String) As Boolean
On Error GoTo copy_error
If Not file_exists(source) Then Exit Function
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
fso.copyfile source, dest, True
copy = file_exists(dest)
On Error Goto 0
copy_end:
Set fso = Nothing
Exit Function
copy_error:
copy = False
Resume copy_end
End Function