I've got CF code that initiates a 3rd party app to generate a file on the web server. I'm trying to create a cfloop condition statement that will continue to loop until the file exists on the server and then redirects the user to it. Unfortunately the following code that I have is not working at all. I've checked the server and the file does indeed exist, but the conditional loop never caught it and goes on forever. Any suggestions welcomed!
<cfset user = url.timekeep>
<cfset filename = user & dateFormat(now(),"mmddyy")& ".pdf">
<cfset path = "/payroll/" & user & "/" & filename>
<cfset completePath = ExpandPath(path)>
<cset urlPath = " & user & "/" & filename>
<cfloop condition="fileExists(completePath)">
</cfloop>
<cflocation url="#urlPath" addtoken="no">
<cfset user = url.timekeep>
<cfset filename = user & dateFormat(now(),"mmddyy")& ".pdf">
<cfset path = "/payroll/" & user & "/" & filename>
<cfset completePath = ExpandPath(path)>
<cset urlPath = " & user & "/" & filename>
<cfloop condition="fileExists(completePath)">
</cfloop>
<cflocation url="#urlPath" addtoken="no">