[cs631apue] FTS directories visited twice

Yuxi Wang ywang286 at stevens.edu
Tue Oct 15 14:26:42 EDT 2019


Hello,

Just ignore “FTS_DP” fts_info in the loops. This ensures that the file tree is pre-order traversed.

Yuxi Wang


________________________________
From: cs631apue-bounces at lists.stevens.edu <cs631apue-bounces at lists.stevens.edu> on behalf of Devharsh Trivedi <dtrived5 at stevens.edu>
Sent: Tuesday, October 15, 2019 1:46:25 PM
To: Zixuan Chen <zchen91 at stevens.edu>
Cc: cs631apue at lists.stevens.edu <cs631apue at lists.stevens.edu>
Subject: Re: [cs631apue] FTS directories visited twice

>From manual:

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.  It is
     possible to walk the hierarchy "logically" (ignoring symbolic links) or
     physically (visiting symbolic links), order the walk of the hierarchy or
     prune and/or re-visit portions of the hierarchy.


I have used fts_info attribute for printing once.


On Oct 8, 2019, at 6:45 PM, Zixuan Chen <zchen91 at stevens.edu<mailto:zchen91 at stevens.edu>> wrote:

Hello Professor,
I see that in the FTS description, directories will be visited twice, both in preorder and postorder. Could you tell me the purposes of doing that? And what can we do in order to avoid printing the name of upper directory twice when only listing the content of current working directory?
Thanks.

Best Regards,
Zixuan Chen
_______________________________________________
cs631apue mailing list
cs631apue at lists.stevens.edu<mailto:cs631apue at lists.stevens.edu>
https://lists.stevens.edu/mailman/listinfo/cs631apue

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20191015/29a2f8be/attachment.html>


More information about the cs631apue mailing list