[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Portably iterate over a directory
- From: Robert Raschke <rtrlists@...>
- Date: Tue, 1 Dec 2009 12:05:03 +0000
It also helps to remember that folder structures are not trees! They are directed graphs.
In case you are trying to be really general, you need to be able to recognise that you're iterating over part of the graph you have previously encountered. You can ignore the graph structure only if you know in advance what you'll be iterating over.
With a tool like find, you get constrained into either getting a symlink name or having it follow the link. But following the link can result in endless cycles.
I'm not 100% sure about Windows folder structures, but you can get links there too. So a little bit of investigation would be needed to figure out what dir does with those. Although, I think cyclic folder structures are not as common in Windows as they are on Unix.