def traverse(self):
        '''
        Recursive generator that lazily unfolds the filesystem.
        '''
        yield self, 0
        if self.name in self.expanded:
            for path in self.getpaths():
                for child, depth in path.traverse():
                    yield child, depth + 1