I'm unclear as to why DoEvents() would have anything to do with closing
files.

Regarding drive caching, I haven't had to touch that since Windows 2000
days so I doubt that's an issue.

You also really don't want to turn SMB2 off and shouldn't have to these
days, assuming your server and workstations are up to date.

So - what does that leave? 

This is running on a server. Is it a Windows service? An EXE run by the
scheduler? An EXE that starts when the server starts?

I would start with making the problem situation happen and then using
Process Explorer to see what has open handles on the file. Could be
another instance of your EXE. Could be a workstation. Could be AV. Could
be the Windows Indexing Service.

Could you amend the server code to wrap the delete in some error
handling and maybe use a sleep and retry?

Declare Sleep IN Win32API Integer nMilliseconds

lnTries = 1
Do while lnTries <= 10
  Try
    delete file (lcFile)      && -- Attempt delete.
  catch
    sleep(5000)    && -- No dice, sleep for 5 secs to let other process
    release it.
  finally
    if !file(lcFile)    && -- Did it get deleted? Then exit the Do loop.
       exit
    endif
  endtry

  lnTries = lnTries + 1

EndDo

* -- File still here after above? 
if file(lcFile)
   * ERROR Damn thing won't die
endif

-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to