Re: File is in use



Peter Morris [Droopy eyes software] wrote:
I have a report which passes parameters to a calculation routine and receives a set of results. The report executes this routine many times, the routine takes about 100 milliseconds to run.

For tracking purposes, every time I run the routine I write the parameters to a text file using a TStringList. My problem is that rarely I get an exception from the SaveToFile method telling me that the file is in use.

Has anyone else experienced this? If so do you have a solution?

I have seen this happening due to anit-virus software locking the file for a tiny moment, but long enough for your software to fail.


Resolution #1: Burn down the Symantec headquarters.

Resolution #2: Retry accessing the file after a short moment. Generally the anti-virus S/W unlocks the file when its done.

The file extension has an influence. *.dat file for example get checked, thus locked, by Norton, but *.weirdextension often isn't. So often changing the file extension helps. It does not hurt either to not release the file lock while you need it, preventing any other application from grabbing it.

Jan Derk
.



Relevant Pages

  • Re: Using an Excel sheet for batch delete
    ... C - My list of filenames in column A have no file extension. ... When I run the routine it does not find them in the source folder. ... My list could have hundreds of filenames, and to have to add the extension before running the routine would be laborious indeed. ... Also, where a filename in column A is not found in the source folder, ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Using an Excel sheet for batch delete
    ... Do you want the routine always to look up the file extension, or should we first check if the filename include an file extension? ... could each filename be marked 'Moved' or 'Not Found In Source Path' when the routine runs? ... that the routine could be made to ignore the file extension when checking if the file is present in the source folder? ...
    (microsoft.public.excel.worksheet.functions)