Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 75

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 80

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 115

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 120

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 161

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 166

Warning: SQLite3::query(): database is locked in /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php on line 208

Warning: http_response_code(): Cannot set response code - headers already sent (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:75) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 115

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:75) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:75) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:75) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:75) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:75) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:75) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/vendor/miniframe/statistics/src/Service/Storage.php:75) in /var/www/html/vendor/miniframe/core/src/Core/Bootstrap.php on line 117
Stefan Thoolen .nl | VB6 Function Database

Visual Basic 6 function "copy"

Go back

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