This is Python code for updating the file modification date of a file on MacOSX or Linux. In this example, I had copied .dv files from my camcorder, which encoded the date in the filename, but had as the modification date, the time I transferred the file from the camcorder.
import os
import time
fpath = '/path/to/dv/files'
for root, dirs, files in os.walk(fpath):
for name in files:
if name[-3:]=='.dv':
try:
t = time.mktime(time.strptime(name, 'clip-%Y-%m-%d %H;%M;%S.dv'))
os.utime(os.path.join(root,name), (t,t))
except ValueError as err:
print(root,name)
print(err)