Ray Camden put up a Friday Puzzler to compare directories. This felt like a place to quickly throw some ColdFusion query of queries together. This solution will work with small directories, but certainly, I doubt that this will scale nicely as it would end up generating ENORMOUSLY SQL statements.
To start off with, I created two small directories:
Each directory has a file that is unique to them (a-only.txt and b-only.txt). Each on has a duplicate file (duplicate_file.txt). And, each on of them has a duplicate file that is a different size (20071207.txt). To compare these two directories from the directory, I ran this code:
Launch code in new window » Download code as text file »
When we run that, we get this CFDump output:
| | | | ||
| | ![]() | | ||
| | | |
So, it works for small little directory compares. I know anything about File Diffs or Directory Diffs, so I am sure that there are way more optimized ways of doing this. But, ColdFusion query of queries makes this a rather easy task.
Download Code Snippet ZIP File
Comments (5) | Post Comment | Ask Ben | Permalink | Print Page
No Country for Old Men Starring Tommy Lee Jones, Javier Bardem, And Josh Brolin
Arc90 Classic Arcade Game Night
My solution also used QoQ, but differently:
http://www.coldfusionjedi.com/index.cfm/2007/12/7/Friday-Challenge--Compare-Directories#cB5E79338-19B9-E658-9D3917D4071BDB2D
-R
Posted by Rick O on Dec 7, 2007 at 4:41 PM
Interesting approach. I requested the challenge since I have to write a script to see if previous people were doing their development on the development server or the production server :(
Here is a link to my original idea:
http://www.mediafire.com/?6yttt3x1kdt (download)
http://snippets.dzone.com/posts/show/4864 (view online)
Any thoughts on my solution would be appreciated.
Posted by Kris Brixon on Dec 7, 2007 at 9:37 PM
@Rick,
Your solution is very good. My hat is off to you, good sir. It's nice to see someone who really knows how to leverage ColdFusion query of queries. Sometimes I think they are one of the unsung heroes of ColdFusion.
Posted by Ben Nadel on Dec 10, 2007 at 8:01 AM
Thanks for the article, I was seeking it.
Posted by Gsm Lobby on Mar 21, 2008 at 12:18 PM
"So you can find the information on it on my search resource
http://fileshunt.com"
Posted by Rapidshare on Mar 27, 2008 at 11:50 AM