I am trying to delete old folders, and I ask, does anyone know how to set up a variable that allows me to check the variable 'todaystr', which today is equal to the date and minus 7 days of this line and saves it in another variable. I want to automatically delete old files in a week. The setting of the 'todaystr' variable is shown below.
todaystr = datetime.date.today().isoformat()
I would like to create a variable "oldfile" that stores the current date minus 7 days so that I can delete a file with that date. Thanks for any help.
source
share