> Good suggestion. Another way (I did this in a C++ routine) is to keep a > list of all the directory inodes you process. Every time you open a new > one, you check it against the list. If it matches anything in the list, > you skip that one. Of course this would only work for traversing a > reasonbly sized file tree. > > Vaughn Was that an ordered or unordered list? (My instinct would be to use an ordered or perhaps an indexed list.) Actually what you want is a perfect hash. Any collision means that you've visited the node already. (When I last delt with this problem I was working in PERL and got hashes for free.) For a modest set of I-nodes you might use an array. There should also be a way to do it very nicely with a combination of array and bit-mask.