* Replace all directory reading code by a generic readDirectory() function.
that it can be used by multiple programs.