I am trying to delete old folders and I am asking does anyone know how to set up a variable that allows me to check the variable ‘todaystr’ which is today’s date and minus 7 days of this string and store it another variable. I am wanting to automatically delete old files after a week. Below shows the variable ‘todaystr’ being set up.
todaystr = datetime.date.today().isoformat()
I would like to create a variable ‘oldfile’ that stores the current date minus 7 days so I can delete the file with this date. Thanks for any help.
1 Answer