Sorry for the delay. One way or the other, it looks I haven't received a notification, neither in the 'junk' box.
Earlier posts can be found in thread "Change modified date after filename"
For experts this script probably looks crap, but it works fine for me.
For good order's sake below the script
Rename PATTERN="*" TO="*"
@nodeselect
@script vbscript
Option Explicit
' Change the path below if you haven't installed Opus to the default location:
dim DOpusRTPath
'DOpusRTPath = "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe"
DOpusRTPath = "D:\Directory Opus\dopusrt.exe"
Dim Shell
Set Shell = CreateObject("WScript.Shell")
Function Rename_GetNewName(strFileName, strFilePath, fIsFolder, strOldName, ByRef strNewName)
Dim strDateTime
Dim strCommand
' Set strNewName to an empty string so that Opus does not rename the file.
strNewName = ""
Dim debstr
Dim gettimestamp
gettimestamp = 0
' format: file name+ddmmyyyy hhmmss dd-mm-yyyy hh-mm-ss dd mm yyyy hh mm ss
Dim re0
Set re0 = new RegExp
re0.Pattern = "^(?:.*?)[-_\s]*(0[1-9]|[12][0-9]|3[01])[\s\-\_\.]?(0[1-9]|1[0-2])[\s\-\_\.]?(17[0-9][0-9]|18[0-9][0-9]|19[0-9][0-9]|20[0-2][0-9])[-\s_]?([0-1]\d|[2][0-3])[\s\-\_]?([0-5]\d)[\s\-\_]?([0-5]\d)\.(?:.*?)$"
' format: file name+yyyymmdd hhmmss yyyy-mm-dd hh-mm-ss (with or without dashes)
Dim re1
Set re1 = new RegExp
re1.Pattern = "^(?:.*?)[-_\s]*(17[0-9][0-9]|18[0-9][0-9]|19[0-9][0-9]|20[0-2][0-9])[\s\-\_\.]?(0[1-9]|1[0-2])[\s\-\_\.]?(0[1-9]|[12][0-9]|3[01])[-\s_]?([0-1]\d|[2][0-3])[\s\-\_]?([0-5]\d)[\s\-\_]?([0-5]\d)\.(?:.*?)$"
' format: file name+ddmmyyyy dd-mm-yyyy Date ONLY (no time)
Dim re2
Set re2 = new RegExp
re2.Pattern = "^(?:.*?)[-_\s]*(0[1-9]|[12][0-9]|3[01])[\s\-\_\.]?(0[1-9]|1[0-2])[\s\-\_\.]?(17[0-9][0-9]|18[0-9][0-9]|19[0-9][0-9]|20[0-2][0-9])\.(?:.*?)$"
' format: file name+yyyy-mm-dd yyyymmdd date ONLY without time
Dim re3
Set re3 = new RegExp
re3.Pattern = "^(?:.*?)[-_\s]*(17[0-9][0-9]|18[0-9][0-9]|19[0-9][0-9]|20[0-2][0-9])[\s\-\_\.]?(0[1-9]|1[0-2])[\s\-\_\.]?(0[1-9]|[12][0-9]|3[01])\.(?:.*?)$"
If (re0.Test(strFileName)) Then
strDateTime = re0.Replace(strFileName, "$3$2$1 $4:$5:$6")
gettimestamp = 1
debstr = "(0): " & strDateTime
ElseIf (re1.Test(strFileName)) Then
strDateTime = re1.Replace(strFileName, "$1$2$3 $4:$5:$6")
gettimestamp = 1
debstr = "(1): " & strDateTime
ElseIf (re2.Test(strFileName)) Then
strDateTime = re2.Replace(strFileName, "$3$2$1")
gettimestamp = 1
debstr = "(2): " & strDateTime
ElseIf (re3.Test(strFileName)) Then
strDateTime = re3.Replace(strFileName, "$1$2$3")
gettimestamp = 1
debstr = "(3): " & strDateTime
End If
If (Not IsEmpty(strDateTime)) Then
If (gettimestamp) Then
strDateTime = strDateTime & " " & GetFileModTime(strFilePath & "\" & strFileName)
End If
DOpus.OutputString "Set Date & Time " & debstr
strCommand = """" & DOpusRTPath & """ /cmd SetAttr FILE=""" & strFilePath & "\" & strFileName & """ MODIFIED=""" & strDateTime & """"
DOpus.OutputString "CMD = " & strCommand
Shell.Run strCommand,0,true
End If
End Function
Function GetFileModTime(filespec)
Dim fso, f, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(filespec)
s = split(f.DateLastModified, " ", -1, 1)
GetFileModTime = s(1)
End Function