Check file copy

rodneyb

Registered User.
Local time
Today, 17:25
Joined
Jul 3, 2003
Messages
84
Hi,

I have a database file which is located on the C drive, and I have a process which when executed takes a copy of some files I've been working on and archives them on the work LAN. This currently works fine but there is an issue I need to take care of if the LAN goes down. Ie I need to be able to check that the copy to the LAN has copied over successfully, and if it hasn't then copying it onto the C drive. I need to be able to do this safely and securely.
Is there code that checks to see if a file exists on the LAN as soon as I've copied it over?

Any advice would be greatly appreciated.

Thanks.
 
Rodney,

Don't know if your LAN drive is mapped or not. But you should be able to
use something as simple as the Dir command to check:

Code:
Dim SomeFile As String
SomeFile = Dir("g:Something.BAK")
If SomeFile = "" Then
   MsgBox("It's not there!")
End If

You might also try UNC:

Dir("\\SomeComputer\SomeDir\Something.BAK")

Wayne
 
Use the Dir() function to test if a directory or file exists.

Code:
    If Dir("\\Server\Partition\Directory", vbDirectory) = "" Then
        MsgBox "Can not find server"
    End If
Code:
    If Dir("\\Server\Partition\Directory\TestFile.txt", vbNormal) = "" Then
        MsgBox "Can not find file"
    End If
I am not sure how you would time the calling of the code to only check it after the file was completely copied.
 
Hey thanks guys this is a big help. I will give it a try and let you know how I get on.

Cheers.
 

Users who are viewing this thread

Back
Top Bottom