Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Overwrite a file being Heavily Used

Status
Not open for further replies.

Trob70

Programmer
Sep 25, 2012
89
AU
Using VB2010

I have a server which is heavily accessed by clients via an ftp server...

Every 10 seconds i need to replace (overwrite) the file.

What is the best way to control (file is being accessed by another user)

Over a whole day i received 2 instances of file is being accesses by another user...

At present i am using the following code...IS THERE A BETTER WAY ?????

retries = 3
While True
Try
If File.Exists(FAll2) Then Kill(FAll2)
Rename(FAll, FAll2)
Exit While
Catch
retries -= 1
If retries = 0 Then
Throw
Else
System.Threading.Thread.Sleep(200)
End If
End Try
End While


Really appreciate any advice

Trob



 
Can you switch from using a file to a database table? Use the table for the other processing updating it from what is received via FTP.
 

Its around the other way... i am setting up a file and it is being downloaded from the remote.......

Regards Trob70
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top