方法一:
在系统可以上网的条件下:
1、安装工具:tree;
2、在终端输入
tree -f -i > file_list_path
file_list_path 文件内容即为当前目录下所有文件的相对路径
方法二:
在系统无法上网的情况下:
1、编写python脚本
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 + ' ') # 写入数据,文件保存在上面指定的目录,加 为了换行更方便阅读 f.close() # 关闭文件 file_name(root)
2、在需要查看的目录下运行python 脚本即可