ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: Change (sub) folder(s) date based on newest/oldest file in the folder

<< < (27/32) > >>

dcwul62:

Often a screenshot explains things better.


===
DONE: Change (sub) folder(s) date based on newest/oldest file in the folder
====

The script used for the Opus button is as follows

==



--- Code: Visual Basic ---@script vbscriptOption 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

I tried to mess around with the regex (line 14) but didn't how to solve this.
On and on I tried with Opus rename
fm:  bla bla
to: \1\\\2 
(that you suggested in earlier threads)
but a. I didn't know exactly what I was doing and b. it did not work out, so gave up on that one.

However, maybe.. what I am asking is simply impossible.

brgds
=

==

4wd:
^(.*?\d{4})(?:.*)

dcwul62:
Will the current regex still work then?


later...
I check, regretfully it doesn't.
will re-instate the previous regex

--- Code: Visual Basic ---"(.*?)(?:([-\s]\d[-\s\d]*\.\w+)|\.\w+)$"
=
DONE: Change (sub) folder(s) date based on newest/oldest file in the folder
=

4wd:
Have you thought of having more than one button since your file naming conventions are so diverse?

dcwul62:
Nope, right now, all the renames (except this 'new' one) cud be covered with the existing regex.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version