program is able to search the target folder but unable to print the result