I am on CF9.  I am making a temp folder and putting pdfs in it.  Then I do a 
merge.
Afterwards, I do a CFContent to view the pdf.  Then I do a cfdirectory, get a 
list of the Directories and delete any directories over an hour old.  This is 
not working.

If I comment out the cfcontent, it works fine and all is well.  Put the 
cfcontent back in and my directories are left.  Some of these directories are 
days old, so there is no active/open content in them.  To assure this, I still 
create the directories for the pdfs to merge, but I output it and view it in 
the parent directory, so deleting these directories should be simple.

If I move the directory deletion BEFORE the cfcontet tag, then it deletes them 
fine, but that's not where I need them to be.

So here's the code, but there is a directory created with a unique name (e.g. 
Z-13221-503881377293800337) before this and stuffed with pdfs.

<CFCONTENT type="application/pdf" file="#view_file#" deletefile="yes"><!---     
--->
        <!--- delete currently used dir --->    
<cfdirectory action="delete" directory="#output_path#" recurse="yes">
<cfdirectory action="list" name="pdf_dir_listing" directory="#directory_path#">
        after 1 folder delete<br>
<cfdump var="#pdf_dir_listing#">        
<cfloop query="pdf_dir_listing">
    <cfset the_mod_date = ParseDateTime(datelastmodified)>
    <cfif DateDiff('n',the_mod_date,now()) gt 60> <!--- more than 1 hr old --->
        <cfif DirectoryExists(tmp_path)>
           <cfdirectory action="delete" directory="#tmp_path#" recurse="yes">
        </cfif>
    </cfif>
</cfloop>
                after many folder delete<br>
<cfdirectory action="list" name="pdf_dir_listing"  
directory="#directory_path#"> <cfdump var="#pdf_dir_listing#">

The paths are fine because this works without the cfcontent. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:356554
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to