dir_iterator: new API for iterating over a directory tree