[DUG] Delete (File) Function ?
Conor Boyd
Conor.Boyd at trimble.co.nz
Mon Jun 30 14:13:57 NZST 2008
Not really going to get into the specifics of what's happening in your
particular instances, but another suggestion might be to make use of the
RunOnce key in the Registry to delete files the next time Windows starts
up.
See http://delphi.about.com/cs/adptips1999/a/bltip0799_3.htm for some
sample code.
However, IMHO Windows itself doesn't keep files open any longer than
requested (maybe unless they're DLLs or something). If the file in
question is a file opened/used by your application, and Windows tells
you it's in use, then I'd strongly suggest your app hasn't closed and
released the file handle properly.
Cheers,
C.
________________________________
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of John Bird
Sent: Monday, 30 June 2008 1:37 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: Re: [DUG] Delete (File) Function ?
I have come across similar problems on Windows Servers over the years in
a couple of cases:
1 - Data Files (non-database in this case) that have been updated and
finished with and closed may remain open or in use as far as the Server
goes. Sometimes this times out after a few minutes and the file does
become not in use. Sometimes it has to be closed manually on the server
(Control panel/Administrative tools/Shared files/Open Files allows one
to manually browse and close an open connection).
Sometimes even more puzzling is a file remaining with a locked block (a
file open for shared read/write) long after the updates have finished.
Same solution.
Incidentally I discovered There is a useful Windows command line variant
of the Administrative Tools GUI -
OPENFILES /Disconnect /O Read/Write (+ other options)
but haven't yet have had a chance to find out if that only deals with
files opened from this workstation or for any workstation or whether it
can be used from a workstation to close files on the server.
2 - Zip file archives that get deleted after a time (usually weeks after
created) sometimes fail to delete - using the same DeleteFile call as
you used. I have not figured out yet why these fail to delete, but they
are on a Windows server again.
I am most interested to hear anyone shed light on this!
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20080630/afe4c104/attachment.html
More information about the Delphi
mailing list