You should read about the Python module datetime.
Here is a good start
You can get the dates from your file names and today's date like this:
from datetime import date, time, datetime
filename = '25032024.jpg'
# get today's date in the same format as the file name
today = date.today() # returns datetime.date(2024, 3, 26)
date2day = today.strftime("%d%m%Y") # returns '26032024'
# split the file name on . to get the date
# this returns a list
# get the first elemant of the list
data = filename.split('.')
fdate = data[0] # looks like '25032024'
# get the date as a datetime object
# need to tell datetime the format and order of the date: %d = day, %m = month, %Y = year
dt = datetime.strptime(fdate, "%d%m%Y") # returns datetime.datetime(2024, 3, 25, 0, 0)
# get the date of the file as day month, year
date_of_file = dt.strftime("%d%m%Y") # returns '25032024'
# compare the dates
date_of_file == date2day # returns False
# try another file date
fdate2 = '26032024'
dt2 = datetime.strptime(fdate2, "%d%m%Y") # returns datetime.datetime(2024, 3, 26, 0, 0)
date_of_file2 = dt.strftime("%d%m%Y") # returns '26032024'
date_of_file2 == date2day # returns True
First you need a list of all files. Loop through the list, getting each date from the file name and comparing it with today as above.
datetime has many abbreviations to help you deal with different date and time formats. Below are some of them:
dt = datetime.now()
print(dt)
print('\nDirectives\n--------------')
print(dt.strftime('Weekday short version : %a'))
print(dt.strftime('Weekday full version : %A'))
print(dt.strftime('Weekday as a number : %w'))
print(dt.strftime('Day of month : %d'))
print(dt.strftime('Month Name short ver : %d'))
print(dt.strftime('Month Name full ver : %b'))
print(dt.strftime('Month as a number : %m'))
print(dt.strftime('Year short version : %y'))
print(dt.strftime('Year full version : %Y'))
print(dt.strftime('Hour (00-23) : %H'))
print(dt.strftime('Hour (00-11) : %I'))
print(dt.strftime('AM/PM : %p'))
print(dt.strftime('Minute : %M'))
print(dt.strftime('Second : %S'))