def fixFileDate(fileName):
  """Reads file's EXIF header, gets the earliest date and sets it to the file"""
  dates = getFileDates(fileName)
  if (dates['exif']):
    cmp_time = lambda x, y: list(x)[: - 1] != list(y)[: - 1]
    diff = [cmp_time(dates[x], dates['exif']) for x in ('mtime', 'ctime')]
    if(sum(diff)):
      setFileDates(fileName, dates)
    return dates, diff
  else:
    return dates, None
Reads file's EXIF header, gets the earliest date and sets it to the file
recipes/Python/576822_Redate_pictures_with_EXIF/recipe-576822.py