# -*- coding: UTF-8 -*-
# 作者：huanhuilong
# 标题：Python 文件遍历2
# 描述：遍历一个文件夹下的所有子文件夹下文件，并返回绝对路径列表

import os


def retrieve_file_paths(dir_name):
    file_paths = []
    abs_dir_name = os.path.abspath(dir_name)
    for root, directories, files in os.walk(abs_dir_name):
        for file_name in files:
            file_path = os.path.join(root, file_name)
            file_paths.append(file_path)
    return file_paths


if __name__ == '__main__':
    file_paths = retrieve_file_paths('./')
    print(file_paths)
