import os
from datetime import datetime
from dateutil.relativedelta import relativedelta
current_day=datetime.today()
lst_month=current_day-relativedelta(months=1)
lst_mth=lst_month.strftime('%Y%m')
filepath = r'\work\estmtDelivery'+'\\'+lst_mth +'\\' +'tmp'
for file in os.listdir(filepath):
exldFile = 'customer_'+lst_mth+'.txt'
if file !=exldFile:
os.remove(os.path.join(filepath,file))
print('Deleted!')
print(file)