[cs631apue] fts functions

Jan Schaumann jschauma at stevens.edu
Sat Sep 27 21:24:00 EDT 2014


Boxiang Dong <bdong at stevens.edu> wrote:
 
> I played the fts functions like fts_open(), fts_read() and fts_children()
> for a while, and found out that the fts functions go through the file
> hierarchy in DFS fashion.

Read the manual page:

| In general, directories are visited two distinguishable times; in
| pre-order (before any of their descendants are visited) and in
| post-order (after all of their descendants have been visited).  Files
| are visited once.

The fts_info field contains information about whether or not an entry is
visited in pre- or post-order.  That is, it is up to you how you'd like
to process the results.

> But what we need 

How do you decide what the "right" order is?

-Jan


More information about the cs631apue mailing list