Home > Mobile >  How to update media file timestamp from its metadata
How to update media file timestamp from its metadata

Time:01-19

When I copied files through different hard disks, the date has been overwritten. I would like to reset the timestamp of media files especially images from the meta data property like 'Date taken' in windows or the 'create' and 'update' times in linux ?

Does it need a script or is there a command? Either windows or linux is fine? Is there a simple way in python?

Thanks

CodePudding user response:

Assuming you mean the file system time stamps, you can use exiftool.

Your basic command for most images would be

exiftool "-FileCreateDate<DateTimeOriginal" "-FileModifyDate<DateTimeOriginal" /path/to/files/

For MP4/Mov files, it's a bit more complicated as the embedded time stamps are in UTC and not local time. You would most likely use this command

exiftool -api QuickTimeUTC "-FileCreateDate<CreateDate" "-FileModifyDate<CreateDate" /path/to/files/

These commands creates backup files. Add -overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories.

  •  Tags:  
  • Related