I am having a problem with filecopy. It works most of the time.
Code:
If Len(Dir$(yigFile)) > 0 Then printout "Delete: " & yigfile Kill yigFile If len(dir$(yigFile)) <> 0 Then printout "Error!! Kill FAILED!" printout "Err = " & Str$(Err) End If Sleep 500 If Len(Dir$(gameFile)) > 0 Then printout "Rename " & gameFile & " As " & yigFile FileCopy gameFile, yigFile Sleep 500 Kill gameFile Sleep 500 If len(dir$(yigFile)) = 0 Then printout "Error!! Rename FAILED!" printout "Err = " & Str$(Err) End If
The file names (gameFile and yigFile) are always the same.
There is over 2 gigs of free disk space on the drive with the files and the files themselves are 50K to 1000K in size.
The program works most of the time, but once in a while the message:
Error!! Rename FAILED!
Err = 0
. . . shows up in the log file. The fails have happened on machines running Windows 95, Windows 98 and Windows NT.
I was told that it is a timing problem, As in windows can sometimes delay the new file coming into "existance" so that Dir$() does not see it if called to quickly. That is why I added the sleeps.
If I stop the program when the error hits and wait for the file to show up, it never does. Any guesses?
Tim Wisseman
Comment