|
发表于 2018-9-25 09:33:22
|
显示全部楼层
- import os
- def check_action_movie(path):
- result = []
- for item in os.listdir(path):
- deep_path = os.path.join(path, item)
- name = os.path.splitext(item)
- print(name,deep_path)
-
- if name[1] in ['.avi', '.rmvb', '.mp4', 'MPG'] and os.path.isfile(deep_path):
- result.append(deep_path)
-
- if os.path.isdir(deep_path):
- try:
- check_action_movie(deep_path)
- except:
- continue
-
- result_write = 'moviefile.txt'
- result_file = open(result_write, 'w')
- result_file.writelines(result)
- result_file.close()
- path = input("请输入待查找的初始目录: ")+os.sep
- check_action_movie(path)
复制代码 |
|