"DirectoryList" and differences sorting by name between Lucee 5 and Lucee 6

Description

In lucee 5 if I did directorylist and set the ‘sort’ to ‘name asc’ my files were returned in the following order:

 

C:\sql\build\00001-Version8.8-AgentPortal-Roles-TimeZones\00001_RenameTbl_G4Agent.sql
C:\sql\build\00001-Version8.8-AgentPortal-Roles-TimeZones\00002_CreateTbl_G4AgentSite.sql
C:\sql\build\00001-Version8.8-AgentPortal-Roles-TimeZones\00002a_AddData_G4AgentSite.sql
…..

In lucee 6 they are sorted differently

C:\sql\build\00001-Version8.8-AgentPortal-Roles-TimeZones\00001_RenameTbl_G4Agent.sql
C:\sql\build\00001-Version8.8-AgentPortal-Roles-TimeZones\00002a_AddData_G4AgentSite.sql
C:\sql\build\00001-Version8.8-AgentPortal-Roles-TimeZones\00002_CreateTbl_G4AgentSite.sql
…..

The code is:

<cfset buildFiles = DirectoryList( path='sql\build', recurse=false, listInfo=false, type="file", sort='name asc', filter=function(thefile){ return Left(GetFileFromPath(thefile), 1) neq 'z'; } )/>

 

I’m sure I can work around this, but curious as to what may have changed?

 

Thanks.

Activity

Show:

Michael Offner 16 May 2024 at 08:18

Pothys - MitrahSoft 7 November 2023 at 10:54

Added a testcase for this ticket https://github.com/lucee/Lucee/pull/2270/commits [disabled]

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Affects versions

Priority

Created 6 November 2023 at 22:50
Updated 6 March 2025 at 11:39

Flag notifications