方法一:python
在系统能够上网的条件下:工具
一、安装工具:tree;spa
二、在终端输入code
tree -f -i > file_list_path
file_list_path 文件内容即为当前目录下全部文件的相对路径对象
方法二:blog
在系统没法上网的状况下:utf-8
一、编写python脚本get
import os root = os.getcwd() def file_name(file_dir): with open(root+'_pwd', 'w', encoding='utf-8') as f: # 使用with open()新建对象f for root_dir, dirs, files in os.walk(file_dir): for file_names in files: print('.' + root_dir[len(root):] + '/' + file_names) file_path = '.' + root_dir[len(root):] + '/' + file_names f.write(file_path + '\n') # 写入数据,文件保存在上面指定的目录,加\n为了换行更方便阅读 f.close() # 关闭文件 file_name(root)
二、在须要查看的目录下运行python 脚本便可it