Allow directoryList() filter closure to short circuit directory recursion

Description

When you provide a filter closure to a recursive directoryList(), Lucee still gets the full recursive directory listing internally before it starts filtering the results. This behavior can be useful if I want to filter out a folder yet keep files from inside that folder in my results.
However, most of the time I'm wanting to filter out a folder and ALL OF ITS CHILDREN. This makes directoryList() inefficient since I would like for it to just skip the folder entirely and not even recurse into it.

So for some examples:
I'd like this one to return no results and do no recursion at all.

directoryList( 'D:\massive\directory\', true, 'path', (p)=>false )

And for a more realistic example, I don't want Lucee even bothering to recurse into the .git sub dir.

directoryList( 'D:\massive\directory\', true, 'path', (p)=>!p.startsWith('D:\massive\directory\.git')

I realize this is a breaking change from the current behavior, so an additional parameter may be required to accommodate the optimized short circuit filter behavior.

Activity

Show:

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

Priority

Created 1 September 2021 at 16:02
Updated 1 September 2021 at 16:02

Flag notifications