This might be clumsy but, it works for me.  I use it to delete files more
than five days old from a directory.  I loop through the directory and
compare the last modified date.

<cfset deletedate = #dateadd("d",-5,now())#>
<cfset newformateddate = #dateformat(createdate(year(deletedate),
month(deletedate), day(deletedate)), "mm/dd/yyyy")#>

<cfset cleanup_path = "d:\Inetpub\wwwroot\blah blah\">
<CFdirectory directory=#cleanup_path#
    NAME="CleanUpDirectory"
    SORT="name ASC, size DESC">

<CFLOOP Query="CleanUpDirectory">
        <CFIF #type# IS "File">
                <CFIF #datelastmodified# LT #newformateddate# >
                        <CFFILE ACTION="Delete"
                        FILE="#cleanup_path##Name#">
                </CFIF>
        </CFIF>
</CFLOOP>

Michele
-----Original Message-----
From: Scot VanAlstine [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 29, 2005 7:34 AM
To: CF-Newbie
Subject: Re: converting file dates read with cf directory

Hard coding that date won't work because I have a bunch of files with
differet last modified dates.  Is there something I am missing?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:15:792
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to