FredixBlog


Just my log about anything I could find enjoyable.



Archive for June, 2004

Check if file exists

author Posted by: fredometro on date Jun 3rd, 2004 | filed Filed under: MS-Access

It is often needed to know wether or not a file exists.
This simple function will do the job.
For instance, if we need to delete a file if it exists:


If FileExists("c:\myfile.txt") Then
    Kill "c:\myfile.txt"
End If

Here is the code of the function:


Public Function FileExists(FileName)
    On Error Resume Next
    Open FileName For Input As 1
    If Err = 0 Then
        FileExists = True
        Close 1
    Else
        FileExists = False
    End If
End Function


Warning: include(/home/www/web421/html/phpTraffic/write_logs.php) [function.include]: failed to open stream: No such file or directory in /home/websitef/public_html/fredometro.com/wp-content/themes/blueshadow/footer.php on line 15

Warning: include() [function.include]: Failed opening '/home/www/web421/html/phpTraffic/write_logs.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/websitef/public_html/fredometro.com/wp-content/themes/blueshadow/footer.php on line 15