select ?deep ?dft ?glob ?filter ?follow_links ?error () creates a selctor to customize a file iterator.
The deep and dft arguments controls whether function should recurse in sub-directories. If deep is true, and ~dft is not specified, the files are listed in breadth-first mode (a,b,a/x,b/x,a/x/y for example). If ~dft is `Before, the files are listed in depth-first mode, and the ancestors are before their children. If ~dft is `After, the are after their children.
The glob argument can be used to filter the basenames of files with a regular expression.
The filter argument is called as filter is_dir basename path where is_dir is set when checking whether to enter or not into a sub-directory, basename is the basename of the file and path is the path starting with a '/', yet relative to the initial directory. filter is called on every file with is_dir false to decide whether it should be added or not, and only on sub-directories with is_dir true to decide whether to enter or not if deep is true.
The follow_links argument is used to decide if a link to directory should be followed (when deep is also set).
The error argument is called when an error occurs, with error exn path filename.