"""
@author:eivision
@file: BatchDelFiles.py
@time: 2023/06/12
"""
import os
path = './delFilesTest/'
list=[]
for root, dirs, files in os.walk(path):
for file in files:
if (os.path.splitext(file)[1] =='.dat' or os.path.splitext(file)[1] == '.txt' \
or os.path.splitext(file)[1] == '.xml' or os.path.splitext(file)[1] == '.json'):
list.append(os.path.basename(file))
for index in range(len(list)):
os.remove(path+list[index])
print("Files deleted successfully!!!")
"""
@author:skq
@file: BatchDelFiles.py
@time: 2023/06/12
"""
import os
path1 = './source_images/'
list1=[]
for root, dirs, files in os.walk(path1):
for file in files:
if (os.path.splitext(file)[1] =='.jpg' or os.path.splitext(file)[1] == '.png' \
or os.path.splitext(file)[1] == '.JPG' or os.path.splitext(file)[1] == '.PNG'):
list1.append(os.path.basename(file))
for index in range(len(list1)):
os.remove(path1+list1[index])
path2 = './source_Annotations/'
list2=[]
for root, dirs, files in os.walk(path2):
for file in files:
if (os.path.splitext(file)[1] =='.dat' or os.path.splitext(file)[1] == '.txt' \
or os.path.splitext(file)[1] == '.xml' or os.path.splitext(file)[1] == '.json'):
list2.append(os.path.basename(file))
for index in range(len(list2)):
os.remove(path2+list2[index])
path3 = './JPEGImages/'
list3=[]
for root, dirs, files in os.walk(path3):
for file in files:
if (os.path.splitext(file)[1] =='.jpg' or os.path.splitext(file)[1] == '.png' \
or os.path.splitext(file)[1] == '.JPG' or os.path.splitext(file)[1] == '.PNG'):
list3.append(os.path.basename(file))
for index in range(len(list3)):
os.remove(path3+list3[index])
path4 = './Annotations/'
list4=[]
for root, dirs, files in os.walk(path4):
for file in files:
if (os.path.splitext(file)[1] =='.dat' or os.path.splitext(file)[1] == '.txt' \
or os.path.splitext(file)[1] == '.xml' or os.path.splitext(file)[1] == '.json'):
list4.append(os.path.basename(file))
for index in range(len(list4)):
os.remove(path4+list4[index])
print("Files deleted successfully!!!")