删除文件夹中低于7个文件的文件夹
#删除文件夹中低于7个文件的文件夹
import os
import shutil
rs3 = __file__
rs4 = rs3.split("/")[:-1]
temp_path = '/'.join(rs4)
listDir = os.listdir(temp_path)
# print(listDir)
for item in listDir:
item = temp_path + "/" + item
if os.path.isdir(item):
listDir1 = os.listdir(item)
if len(listDir1) <= 6:
shutil.rmtree(item)
print("remove success",item)
else:
print("this is file")