I having a problem with a piece of code that checks for the existence of a 
file, renames the file, and then deletes the file. The code is run in a 
child window after the user clicks the submit button on the parent window. 
The problem occurs when a user closes the child window while the thread is 
running and then clicks the submit button on the parent window again.

The message appears on the NT Server saying that the file is missing. I 
have tracked it down to the cffile action="RENAME" statement in the code 
below. It appears that the first thread is still processing the delete when 
the second thread is checking for the existence of the file. The first 
thread then finishes and the second thread tries to rename the now 
non-existence file and the error occurs.

Is there something I'm missing with the CFLOCK statement. Also, this is not 
happening all the time. There is some sort of timing issue. I have read 
where a delete on a NT Server does not happen right away. So, my question 
has anybody run into a similar problem and came up with a fix?

Here is the code:

<cflock name="arexcelr" type="exclusive" timeout="10">
<cfif FileExists("e:\inetpub\wwwroot\app\junk.txt") is "Yes">
        <cffile action="RENAME" source="e:\inetpub\wwwroot\app\junk.txt" 
destination="e:\inetpub\wwwroot\app\junk.del">
        <cffile action="DELETE" file="e:\inetpub\wwwroot\app\junk.del">
</cfif>
</cflock>


Thanks,

Jack Tumlin
Vice President Business Development
Millennium Software, Inc.
The Software Solutions Company
[EMAIL PROTECTED]
www.millsoftinc.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to