mod_dav_fs already has this walking code, with callbacks. It has a notion of postfix walking so that a recursive delete can be performed.
Of course, there is some DAV-related crap in there, too :-) But take a look at modules/dav/fs/repos.c for the "walk" stuff, and its related context structure. One of the questions would be how to arrange the callbacks such that a client can "telescope" paths themselves. For example, if you're copying things, you need to telescope source and dest paths. mod_dav_fs also has to telescope a URI during the walk. Cheers, -g On Thu, Feb 14, 2002 at 03:11:06PM -0800, Ryan Bloom wrote: > This would get my +1! > > > > What about having a function that recursively walks the directory > > > structure and just calls a supplied callback function with the file > > > name. This looks like a simple way to implement this and it could > > > easily belong in APR. > > > > That would be great! And then apr_dir_remove_recursively() could be > > implemented in terms of such a function (it would have to promise to > > invoke the callbacks on leaf nodes, and then empty dirs, drawing up > > toward the root of the tree, I guess). > > > > CC'ing the APR list for reactions. > > > > -Karl -- Greg Stein, http://www.lyra.org/