Search code examples
coldfusioncfdirectory

How do I use multiple sort criteria in cfdirectory list?


I know that cfdirectory has a tag for sort, and if I have sort="DateLastModified DESC", it works. If I have sort="Name DESC", it works. But if I have sort="DateLastModified DESC, Name DESC", it doesn't do the second sort. I've tried both using a comma and a pipe to separate, neither works.

<cfdirectory 
    action="List" 
    directory="#docRoot#" 
    type="file" 
    Recurse="Yes" 
    sort="DateLastModified DESC, Name DESC" 
    name="FileQ" > 
<cfdump var="#FileQ#">

Solution

  • We recopied the files with correct dates, so the issue resolved itself. However, I think Bernhard Dobler may have hit the nail on the head, it is most likely that the DateLastModified was not completely identical (off by milliseconds)