maybe use cfdirectory and look at 'dateLastModified' to wait for it to be 2~5 old (so you know it has finished writing to it)
I would make a retry loop, say 5 times with a sleep in between and break out if file found On 30 May 2012 07:03, Mary Jo Sminkey <[email protected]> wrote: > > I've run into this a number of times the last few months and couldn't find > anything in the archives that really seemed to address it. It's a common > enough issue that I'm sure people have dealt with it, and I'm curious what > solutions you might use. > > Basically I have situations where I need to wait for ColdFusion to finish > creating a file before displaying it. The legacy code I'm working with > using a cfexecute to run an executable file, and it uses this code snippet: > > <cfloop condition="NOT FileExists(theFileName)"></cfloop> > <cfinclude template="viewFile.cfm"> > > So basically it loops until it finds the file and then sends it down via a > cfcontent tag. > > I'm not particularly fond of this as if for any reason the executable > fails, you end up waiting for a timeout situation. In the past I've used a > sleep() to just pause the page but that's not particularly ideal either. > > Any better options, or maybe a combination of the two? > > > Mary Jo > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351360 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

