Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / August 2005



Tip: Looking for answers? Try searching our database.

Comparing File Content

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mjtopas - 29 Aug 2005 22:47 GMT
I need to compare file sizes where we're trying to determine if a file output
changed since yesterday.  We were thinking of reading the files into variables
and then hashing each of the files to determine if the files are actually the
same.  Currently we're only checking for file size differences but a change can
occur without a change to the file size (e.g. one letter change A-->B).  CF
documentation says not to read large files into a variable though or it could
bring down the server.  Is there a different technique that would help us or a
"plug in" we can obtain that would give us this capability?
BSterner - 29 Aug 2005 23:31 GMT
You can use cfdirectory, and look at the "DATELASTMODIFIED" timestamp.
BSterner - 29 Aug 2005 23:33 GMT
eg)

<cfdirectory action="list" directory="#GetDirectoryFromPath(ExpandPath("*.*"))#" filter="*.txt" name="dir" />
<cfdump var="#dir#" />
a.benton - 30 Aug 2005 15:12 GMT
You should be able to call the code listed below to find the date last modified
of any file.

Ex. <cfoutput>#lastmodified('fullpathtofile')#</cfoutput>
This will return something like {ts '2005-05-31 13:21:40'}

<cfscript>
function lastmodified(filepath) {
    var fso=createobject("com", "scripting.filesystemobject");
    var thefile=fso.getfile(filepath);
    return thefile.datelastmodified;
}
</cfscript>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.