脚本如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os
root_path = r"E:\Movie"
count = 0
result = []
for path, subdirs, files in os.walk(root_path):
for name in files:
file = os.path.join(path, name)
result.append(file)
count += 1
print("共", count, "个文件")
print('----------------')
for i in result:
print(i)
运行结果