If you have your photos correctly sorted in a way:
*/2007-01-01/*.jpg
that script can loop through all and check if the exif DateTimeOriginal matches with the folder.
It will FIX the date, if:
- There is no DateTimeOriginal
- DateTimeOriginal is broken but fixable (Older cameras, like my Canon Powershop produced 2005:2:3 HH:MM_
- The folder's name=date is (at least 1 day) OLDER than the current exif suggests (e.g. Scans, whatsapp photos etc.)