bsd man page for traverse

Query: traverse

OS: bsd

Section: 3wi

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

TRAVERSE(3WI)															     TRAVERSE(3WI)

NAME
traverse - recursively traverse a directory
SYNOPSIS
traverse (path, func) char *path; int (*func) (); func (path, filetype, position) char *path;
DESCRIPTION
traverse applies its argument function func to its argument file pathname path. If path is a directory, then traverse applies func to all its entries. This traversal is in depth first order so that files are processed in the order that they are stored in the directory. The argument func should take three parameters: a file name, a file type, and a position. The call looks like this for directories: (*func) (path, 'd', position); and like this for other files: (*func) (path, 'f', position); The position is 0 when path is first encountered and 1 when traverse is done. This is used to allow processing before and after a direc- tory is processed.
EXAMPLE
list (name, type, pos) char *name; { if (type == 'd') printf ("%s %s ", pos ? "Leaving" : "Entering", name); else /* type == 'f' */ printf (" %s ", name); }
AUTHOR
Gary Perlman
BUGS
There are no diagnostics when directories cannot be searched. December 16, 1984 TRAVERSE(3WI)
Related Man Pages
dirname(3c) - opensolaris
rmdir(2) - bsd
mkdirp(3g) - hpux
rmdirp(3g) - hpux
forest::tree::pure(3pm) - debian
Similar Topics in the Unix Linux Community
Using File Descriptors, traverse a list
Find directory name while traversing subdirectories
PERL - traverse sub directories and get test case results
Traverse through directories
Find a pattern and traverse left and pick something from another pattern