Skip to content

Instantly share code, notes, and snippets.

@richardhughes260
Created December 30, 2013 22:18
Show Gist options
  • Save richardhughes260/8189211 to your computer and use it in GitHub Desktop.
Save richardhughes260/8189211 to your computer and use it in GitHub Desktop.
directoryList Fun :(
<cfscript>
directory='c:/cachedMessages';
variables.dirList=DirectoryList(directory,false,'query','*.eml','desc:DATELASTMODIFIED');
myQuery = new Query(); // new query object
myQuery.setDBType("query");
myQuery.setAttributes(sourceQuery=variables.dirList);
myQuery.setAttributes(maxRows=1);
myQuery.setSQL(" select * from sourceQuery order by DATELASTMODIFIED desc"); //set query
qryRes = myQuery.execute(); // execute query
</cfscript>
<cfquery name="qrydirListPrime" dbtype="query" maxrows="1">
select *
from dirlist
order by DATELASTMODIFIED desc
</cfquery>
<cfdirectory action="list" directory="#directory#" filter="*.eml" name="cfDirectory" sort="datelastmodified desc">
<cfdump var="#variables#">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment