Scot,
If dateCompare returns thus:
-1, if date1 is earlier than date2
0, if date1 is equal to date2
1, if date1 is later than date2
And dateAdd is inserting a modified datemodified for comparison to
datemodified+60, then a file modified on Jan 3, 2005 is going to have
a modifiedDate of March 5, 2005. That means that your resulting
comparison (in shorthand) looks like this:
dateCompare(dateAdd(modifiedDate+60 days),now()) = -1
So I think what you need to be doing is looking for -1 or 0 instead of
+1 in order to trip your deletion tag. +1 is going to delete anything
less than 60 days old instead of 60 days old or older. Unless you want
to delete all your new logfiles... cuz, that could be fun too!
It would seem, though, that you're going to want to use this to
accomplish your ends:
<body>
<CFSET logPath = "#application.logPath#">
<CFDIRECTORY ACTION="List" DIRECTORY="#logPath#" NAME="dir_listing">
<cfloop query="dir_listing">
<cfif dateCompare(dateAdd("d",60,datelastmodified),now()) LTE 0>
<cffile action="DELETE" file="#logPath#/#name#">
</cfif>
</cfloop>
</body>
The only difference is the LTE that replaces GT on line 5.
Laterz,
J
On Tue, 08 Mar 2005 08:42:00 -0400, Scot VanAlstine <[EMAIL PROTECTED]> wrote:
> Well,
> I created the following code but it does not delete the old entries.
> I set the path to the log files "application.logpath" in the application.cfm
> file.
> What am I missing?
> Scot
>
> <body>
> <CFSET logPath = "#application.logPath#">
> <CFDIRECTORY ACTION="List" DIRECTORY="#logPath#" NAME="dir_listing">
> <cfloop query="dir_listing">
> <cfif dateCompare(dateAdd("d",60,datelastmodified),now()) gt 0>
> <cffile action="DELETE" file="#logPath#/#name#">
> </cfif>
> </cfloop>
>
> </body>
>
--
Continuum Media Group LLC
Burnsville, MN 55337
http://www.web-relevant.com
http://cfobjective.neo.servequake.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase Studio MX with Flash Pro from House of Fusion, a Macromedia Authorized
Affiliate and support the CF community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=51
Message: http://www.houseoffusion.com/lists.cfm/link=i:15:737
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