-
"""
-
Python批量删除指定文件夹下的指定文件名的文件
-
"""
-
-
-
import os
-
-
def file_name(file_dir):
-
list = []
-
for root, dirs, files
in os.walk(file_dir):
-
for file
in files:
-
list.append(file)
-
-
return list
-
-
list = file_name(
r'D:\pycharmprojects\never_give_up\PDBbingdata\PL_2017\pdb_pocket')
-
print(list)
-
-
-
# for i in range(len(list)):
-
# print(list[i])
-
# print(len(list))
-
-
for i
in range(len(list)):
-
print(list[i])
-
if list[i][
6] ==
'r':
-
os.remove(
r'D:\pycharmprojects\never_give_up\PDBbingdata\PL_2017\pdb_pocket'+
'/' + list[i])
-
else:
-
continue