Here's a button which will do it:
Updated for 2017 / Directory Opus 12:
This uses proper scripting instead of kludging things through a rename script:
Script inside the button, for reference:
Option Explicit
Function OnClick(ByRef clickData)
Dim strDateTime, strCommand, selItem, re, cmd
Set re = new RegExp
re.IgnoreCase = True
re.Global = False
' Name, ignoring extension, should be something like "2011-07-29_082609"
re.Pattern = "^(\d\d\d\d-\d\d-\d\d)_(\d\d)(\d\d)(\d\d)$"
Set cmd = clickData.func.command
cmd.ClearFiles
For Each selItem in clickData.func.sourcetab.selected
If (re.Test(selItem.name_stem_m)) Then
' Set strDateTime to a string like "2011-07-29 08:26:09"
strDateTime = re.Replace(selItem.name_stem_m, "$1 $2:$3:$4")
' DOpus.Output "DT = " & strDateTime
strCommand = "SetAttr FILE=""" & selItem.RealPath & """ MODIFIED=""" & strDateTime & """"
' DOpus.Output "CMD = " & strCommand
cmd.RunCommand strCommand
End If
Next
End Function
Original post for older versions of Opus:
Filename to Modified Time.zip (1.14 KB)
The button ignores any files that don't have names like 2011-07-29_082609.mp3 (the extension isn't important, but the rest of the name must be in that format).
It uses a regular expression to extract the date & time from the file, so that can be changed to make it work with other filename formats.
Installing the button:
- Download the zip and extract it, so you have Filename to Modified Time.dcf. (Extracting it is important. Don't just double-click the zip to enter it.)
- Enter Customize mode in Opus, via Settings -> Customize.
- Drag the Filename to Modified Time.dcf file to your Opus toolbar and it will turn into a button.
- (Optional) If Opus is not installed in the default location then you should right-click the newly created button, select Edit and change the DOpusRTPath line near the top.
- Click OK in the Customize window to exit Customize mode.
(Here is a short video showing the steps above: nudel.dopus.com/posts/dcf_drop.wmv )
You can now select some files, click the button to set their timestamps (skipping any files whose names aren't in the expected format).
It doesn't recurse into directories, but you can make it do that if you want (just add the RECURSE argument to the Rename command at the top of the button).