Hello i have the below code where i am trying to exclude exact string matches, but it is not giving me the results i intend, as an example if my file name is xyz_20200720.xlsx, the below code would exclude xyz_20200720.xlsx because there is a '2' in the pattern match. All in all i am trying to ignore files with month end dates in name
import glob
import os
import shutil
cleanlist = glob.glob('F://SM//Portfolio Monitoring//TABLEAU//ACTIVE PIPELINE//MONTH END PIPELINE FILES//**/*[!|31|0228|0430|0630|1130].xlsx',recursive=True)
print(cleanlist)
maxclean = max(cleanlist, key=os.path.getctime)
print(maxclean)
os.remove(maxclean)
movelist = glob.glob('F://SM//Portfolio Monitoring//TABLEAU//ACTIVE PIPELINE//DATE SPECIFIC//*')
filetomove = max(movelist, key=os.path.getctime)
targetpath = 'F://SM//Portfolio Monitoring//TABLEAU//ACTIVE PIPELINE//MONTH END PIPELINE FILES//'
shutil.copy(filetomove, targetpath)