Hi all..
         I have a little bit of code that maintains a mirror of some files 
into a seperate mirror directory.  Basically it checks to see if the 
LastModifiedDate of the original file is greater than the lastmodifieddate 
of the mirrored file.  But something is a miss notably one of the rows in 
the Q_NoChangers query says

ALastMod                      MLastMod                    Name
11/02/2001 12:37:48 PM 10/26/2001 02:28:15 PM index.cfm

which indicates that the query thinks that 11/02/2001 is less than or equal 
to 10/26/2001 so something is very wrong....  can anybody see anything 
wrong with my code, have I missed some vitally important caveat with using 
dates with query-of-queries ??  Here is the code...


         <CFIF NOT IsDefined("REQUEST.MirrorDir")>
                 <CFSET ThisPath = 
GetDirectoryFromPath(GetCurrentTemplatePath())>
                 <CFSET REQUEST.MirrorDir = 
"#ThisPath#_MirroredFiles\#Hash(REQUEST.RootPath)#">
                 <CFIF NOT DirectoryExists(REQUEST.MirrorDir)>
                         <CFDIRECTORY ACTION="CREATE" 
DIRECTORY="#REQUEST.MirrorDir#">
                 </CFIF>

                 <CFDIRECTORY ACTION="LIST" DIRECTORY="#REQUEST.RootPath#" 
FILTER="*.cfm" NAME="Q_Actual">
                 <CFDIRECTORY ACTION="LIST" 
DIRECTORY="#REQUEST.MirrorDir#\" NAME="Q_Mirror">

                 <CFQUERY DBTYPE="query" NAME="Q_Changers">
                         SELECT Q_Actual.Name AS Name,
                                Q_Actual.DateLastModified AS ALastMod,
                                    Q_Mirror.DateLastModified AS MLastMod
                     FROM Q_Actual, Q_Mirror
                         WHERE
                         (
                                 Q_Actual.DateLastModified > 
Q_Mirror.DateLastModified
                                 AND    Q_Actual.Name = Q_Mirror.Name
                         )
                         UNION
                         SELECT Q_Actual.Name AS Name,
                                    Q_Actual.DateLastModified AS ALastMod,
                                    Q_Actual.DateLastModified AS MLastMod
                         FROM Q_Actual
                         WHERE
                         Q_Actual.Name NOT IN 
(#QuotedValueList(Q_Mirror.Name)#)
                 </CFQUERY>

                 <CFLOOP LIST="#ValueList(Q_Changers.Name)#" INDEX="file">
                         <CFFILE ACTION="COPY" 
SOURCE="#REQUEST.RootPath##file#" DESTINATION="#REQUEST.MirrorDir#\#file#" >
                 </CFLOOP>

                 <!--- This query is to debug it --->
                 <CFQUERY DBTYPE="query" NAME="Q_NoChangers">
                         SELECT Q_Actual.Name AS Name,
                                    Q_Actual.DateLastModified AS ALastMod,
                                    Q_Mirror.DateLastModified AS MLastMod
                         FROM Q_Actual, Q_Mirror
                         WHERE
                         (
                                 Q_Actual.DateLastModified <= 
Q_Mirror.DateLastModified
                                 AND    Q_Actual.Name = Q_Mirror.Name
                         )
                 </CFQUERY>

                 <!--- dump the queries to see what is going on --->
                 <CFDUMP VAR=#Q_Changers#>
                 <CFDUMP VAR=#Q_NoChangers#>

         </CFIF>



----------
James Sleeman
Innovative Media Ltd
Phone: (03) 377 6262
http://www.websolutions.co.nz/

CAUTION: The information contained in this email message is confidential 
and may be legally privileged. If the reader of this message is not the 
intended recipient you are notified that any use, dissemination, 
distribution or reproduction of this message is prohibited. If you have 
received this message in error please notify the sender immediately and 
destroy the original message and any attachments.

Views expressed in this communication may not be those of Innovative Media 
Ltd.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to