made Traversal of Directories a template method