select ?deep ?dft ?glob ?filter_rec ?filter_fun ?follow_links ?error () creates a selctor to customize a file iterator.
The deep and dft arguments controls whether function should recurse (false by default) 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, path and ignore arguments can be used to filter the files with regular expressions. glob is used to choose the files to keep based on their basenames, it is not used for the recursion itself. path is used to choose the files to keep based on the path, it is not used for the recursion itself. ignore is used to choose the files to ignore, based on their paths, both during the iteration and the recursion.
The kinds argument can be used to restrict the files to the ones of a particular kind.
The filter argument is used to select the files to keep. filter for_rec path should return true if the file is ok, false otherwise. for_rec is true if filter is called to check a directory for recursion, false if it is called for the iteration.
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 filename. The default behavior is to ignore errors.