Implement 'directory_exists' function.