Unwanted File Timestamp Updates

The way I've been preserving original file timestamps for years, in case of accidental timestamp updates (eg: if another program modifies the timestamp such as foobar2000 when adding ReplayGain to MP3 files*) is a system the marvelous user DetlevD created years ago.

  • You first have to store the original file's date modified timestamp to a custom tag in the file itself, using a custom Mp3Tag action of your making.
  • Then if you want to restore the date modified timestamps back to the file itself use DetlevD's Mp3Tag export script which creates and runs a temporary VBS script. It can also apply these in batch (ie: multiple files at once).

The action I use is as follows:

  • Action type: Format Value
  • Field: LAST_FILE_MOD_DATETIME
  • Format string: $if2(%last_file_mod_datetime%,%_file_mod_datetime%)

This action creates the date modified custom tag that can then be used by the export script to apply the original timestamp... Or you could just leave the file as-is since you now have preserved the original timestamp in the file itself.

I personally also like to preserve the date created in the file itself, even though the VBS script doesn't restore that, using:

  • Action type: Format Value
  • Field: LAST_FILE_CREATE_DATETIME
  • Format string: $if2(%last_file_create_datetime%,%_file_create_datetime%)

Only caveat is the VBS script doesn't handle various special characters in paths, so sometimes I have to rename the files first or move them to a different directory temporarily.

I made some small tweaks to the export script, so it doesn't try to open the File Explorer directory following being run and so the temp VBS script is created in the standard Temp directory.

SetFileModDateTime.1.1 (DetlevD) [Modded].mte (6.7 KB)

* I have a tool configured in Mp3Tag for adding ReplayGain to FLAC while preserving timestamps so I only use fb2k for MP3/etc RG.