first function that does traverse a directory