Am using this sooo many times.
Perhaps I should of included that per use royalty routine ...
Glad you're getting some use out of it.

Am using this sooo many times.





@script vbscript
Option Explicit
Dim regex, file, folder, rencmd, sfdcmd, WshShell
Function OnClick(ByRef ClickData)
sfdcmd = "F:\Directory Opus\SetFolDateFM.exe" ' Full path to SetFolDateFM.exe command
Set WshShell = CreateObject("WScript.Shell")
DOpus.OutputString "--- SetFolDate ---"
Set regex = New RegExp
With regex
.Pattern = "(.*?)(?:([-\s]\d[-\s\d]*\.\w+)|\.\w+)$" ' Change the RegExp to what you want
'.Pattern = "(.*?)(?:([-\s]\d{2}).*|\.\w+)$" ' Change the RegExp to what you want
.IgnoreCase = true
.Global = false
End With
sfdcmd = Q(sfdcmd) & " /r " & Q(ClickData.func.sourcetab.path)
For Each file In ClickData.func.sourcetab.selected_files
If Not file.is_dir Then
Set folder = regex.Execute(file.name)
If folder.Count = 1 Then
rencmd = "Rename " & Q(file.name) & " TO " & Q(folder.Item(0).Submatches(0) + "\" + file.name)
DOpus.OutputString file.name + "|" + folder.Item(0).Submatches(0)
DOpus.OutputString rencmd
DOpus.OutputString "--------"
ClickData.func.command.RunCommand rencmd
sfdcmd = sfdcmd & " " & Q(folder.Item(0).Submatches(0))
End If
End If
Next
DOpus.OutputString sfdcmd
WshShell.Run(sfdcmd)
End Function
Function Q(s)
Q = """" & s & """"
End Function

"(.*?)(?:([-\s]\d[-\s\d]*\.\w+)|\.\w+)$"

(.*?\d{4})(?:.*)|(.*?)(?:([-\s]\d[-\s\d]*\.\w+)|\.\w+)$

A lof of folders (maybe 80% of the 180) went fine and got the folderdates based on newest date in file.
My workaround is to go down the folders and then run the adjust timestamp on sub folders (or sub-sub folders).
SOmetimes it also works to run it a number of times, 3-4-5x
Each time I have to
select folder
click button
exec all




You're going to have to zip up your folder/file structure and send it to me since I can't look at it without something to work on. Use skwire's Zero Zipper or since you have DOpus you can use my method.




Did you try it yourself? The redating, I mean.



I'm very confused. I can't get this to do anything at all.. I can't get the context menus to work, ...

Original address: https://www.donationcoder.com/forum/index.php?topic=35881.0