> I think your problem is in this line: > <cfset MyDateLastModified="#aMyUrls[3][i]#.dateLastModified"> > The right side becomes a string, where I think you meant it to be the > date. Later when you do the date compare, you are trying to compare > this string "InGrrdf.dateLastModified" to 15 minutes ago. > > Without testing, I think this would work better: > <cfset MyDateLastModified=aMyUrls[3][i].dateLastModified> > > I could be making my own dumb mistake though. :) > > > -----Original Message----- > > From: Ioannis Papanikolaou [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, November 01, 2006 3:06 PM > > > > This is my first post as I am fairly new to ColdFusion. I am > > using ColdFusionMX > > 7.1 on Ubuntu and apache 2.2. > > > > What I am trying to do with the if statement is to identify > > if there is a file > > in the directory and if it is, to delete it if it is older > > than 15 minutes. The > > code is running on a loop which is performing on an array. As > > far as I know the > > loop is working good so far but at this point the debugger is > > giving me: > > > > "The value "InGrrdf.dateLastModified" could not be converted > > to a date." > > beaware that InGrrdf is the first file that the loop should found > > (#aMyUrls[3][i]#) > > > > This is the problematic code: > > > > <cfdirectory action="list" > > directory="#GetDirectoryFromPath(SavePath)#" > > name="#aMyUrls[3][i]#" filter="#aMyUrls[2][i]#"> > > > > <cfset MyRecordCount="#aMyUrls[3][i]#.RecordCount"> > > <cfset MyDateLastModified="#aMyUrls[3][i]#.dateLastModified"> > > > > <cfif #MyRecordCount# IS NOT 0 and DateCompare(#MyDateLastModified#, > > > DateAdd("n", -15, Now())) eq -1> > > <cffile action="delete" file="#SavePath#"> > > </cfif> > ---------> --------------------------------------------------------------------- > This transmission may contain information that is privileged, > confidential and/or exempt from disclosure under applicable law. If > you are not the intended recipient, you are hereby notified that any > disclosure, copying, distribution, or use of the information contained > herein (including any reliance thereon) is STRICTLY PROHIBITED. If you > received this transmission in error, please immediately contact the > sender and destroy the material in its entirety, whether in electronic > or hard copy format. Thank you. > =========> ===================================================================== > "EMF <idahopower.com>" made the previous annotations.
Hello again, It is true. The problem is that the system recognises a string of laters not a date, and to be honnest I think this is what is happening to the MyRecordCount regardless it is not giving me an error. The problem is that when I use what you suggested : <cfset MyDateLastModified=aMyUrls[3][i].dateLastModified> Then I get an other error which I assume it is syntactic error: You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members. The error occurred in .../test5.cfm: line 40 40 : <cfset MyDateLastModified=aMyUrls[3][i].dateLastModified> Any ideas.!!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258781 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4