scanning each directory and recursively accessing directory inside directory