I have a list of files(Actually these are the files in some directory) as below for example
import os
path = '/home/user/folder'
files = os.listdir(path)
so result is as below
files = ['backup_file_2010-06-30_category.zip','backup_file_2010-06-28_category.zip',
'backup_file_2010-06-26_category.zip','backup_file_2010-06-24_category.zip',
'backup_file_2010-06-23_category.zip','backup_file_2010-06-20_category.zip'
'some_text_files_one.txt','some_text_files_two.txt']
so from this list i need to delete the zip files that contains the date in it on a condition that, the files that are created before five days from today needs to be deleted
I mean if the file created today is backup_file_2013-04-17_category.zip
, we need to delete the files that are created before five days from today something like the files named as backup_file_2013-04-11_category.zip
Can anyone please let me know how to do this in python