tail recursion for get_files function.

tail recursion for get_files function.