topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 1:42 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: DONE: Change (sub) folder(s) date based on newest/oldest file in the folder  (Read 136685 times)

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
v0.3.1.2 - here

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
Many, many thanks for SetFolDate v0.3.1.2 !

Fantastic!!

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
I am not sure - I am doing something wrong, definitely.
Cud you assist?

=
SnagIt-04022014 164201.pngDONE: Change (sub) folder(s) date based on newest/oldest file in the folder
=

thanks a lot!

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
Think I goofed there somewhere, I'll have a look at it.

Try the Explorer version in the meantime, seemed to work here.

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
Yes, Explorer works fine indeed. ;)

As for Opus below for your info only.

=
SetFolDate-ToolbarButton-05022014 071225.pngDONE: Change (sub) folder(s) date based on newest/oldest file in the folder
=
SetFolDate-OUC-05022014 072036.pngDONE: Change (sub) folder(s) date based on newest/oldest file in the folder
=

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
Hello again,
The below steps I am doing -very..- often.

In Directory Opus I have a number of items in the context menu (right window pane), that saves files to folders named of the filename.

e.g. I have files like.:
this is file1.txt
this is file2-01-01012014.txt
this is file3-01012014 12:34:56.txt

in the context menu of Opus I have a few commands that will save the files to new folders like:
folder this is my file1
folder this is my file2
folder this is my file3

2nd step is that I use setfoldate to change the dates of the newly created folders to set to newest filedate/

A bit this way

=
SnagIt-05022014 135930.pngDONE: Change (sub) folder(s) date based on newest/oldest file in the folder
=

To move files to a folder I use various regex

e.g.
Create Filenamed Folder to MOVE to... (Date+Time)
Rename REGEXP PATTERN "(.+)(-|\s)(\d{6}|\d{8}|\d{2}-\d{2}-\d{4})(-|\s)(\d{6})\.(.+)" TO \1\\\0

Sofar, everything okay.

I doNOT know if the below is possible(!)...

I would like to have the rename syntax (see above) to also include a way that setfoldate is executed default newest file recursive
so I donot need to do the 2nd step.
i.e. when I do a move to folder named after filename, then the folderdate is automatically adjusted.

Is this possible?

=





4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
Say you're saying that after all the, literally, minutes I spent slaving over its interface, you don't want to see it?

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
No, I did not say that...  don't get me wrong.
The interface is fine.

What I did ask is if it possible for specific tasks to run it 'silently' (without interface) in combination with the regex.
For all other tasks and users the interface should definitely remain in place.

If not, forget it, I will use the interface, just like I do now.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
« Last Edit: February 07, 2014, 04:02 AM by 4wd »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
v0.3.1.3 - Added: Can run in no GUI mode using last saved options.

Here's an example UserCommand for DOpus:

Code: Text [Select]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <usercommand backcol="none" hide_from_menu="no" textcol="none">
  3.         <label>Adjust_Timestamp_NG</label>
  4.         <user_label>Adjust_Timestamp_NG</user_label>
  5.         <icon1>#usercommand</icon1>
  6.         <function type="normal">
  7.                 <instruction>@dirsonly</instruction>
  8.                 <instruction>Go {ss}</instruction>
  9.                 <instruction>&quot;C:\SetFolDate2\SetFolDateFM.exe&quot; /r {ss} {allfile}</instruction>
  10.         </function>
  11. </usercommand>

@dcwul62 - in case it wasn't obvious, my remark about the GUI was the usual dry Aussie humour coming out  ;)

Albeit with a rather obvious grammatical screw-up  :-\
« Last Edit: February 07, 2014, 04:05 AM by 4wd »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
No problem  of course :)

Thanks for the work.
Solution is indeed very close. I need to select the folder and click on the button.

Tried to do the same without a toolbar button, but adding: "F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile}
to the existing move to folder context menu.

=
SnagIt-07022014 163528.png
SnagIt-07022014 161950.pngDONE: Change (sub) folder(s) date based on newest/oldest file in the folder
=

But that did not work out properly, regretfully so.

The newly created folder is nog selected, maybe that cannot be changed... and is normal behaviour.
When I select the folder, SetFolDate window, of course, disappears and should be brought up again from the taskbar.

The 'select folder' + 'adjust timestamp' should be skipped and should be done automatically.

Again.. maybe I asking something that is impossible. Really don't know.
The button works fine though.

THanks
=






4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
If, as shown in your image, you only have the one folder left after the rename then you could try adding:

Select ALLDIRS

before the SetFolDate command to select the folder, (well, all folders really).

Ideally, you'd set a variable to the folder you want to create and then use it as an argument to both the Rename and SetFolDate commands.
« Last Edit: February 14, 2014, 12:10 AM by 4wd, Reason: Fix DOpus command »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
Hello again,
I am not sure how to set a variable, but have spent quite some time on searching on Opus support site.
Up front: I have _no_ knowledge of the DOpus programming stuff!  I always try this, try that, try so-and-so, which is costing a lot of time.
Then again... frankly speaking, if, for me, it would not sense spending much time on trying to familiarize myself with DOpus programming:
except for the few tweaks here and there, I use it pretty much in default settings.

Anyway, somewhere in some forum thread I found  ' /p {sourcepath}  '
http://resource.dopu...iewtopic.php?p=43750

and added that to the setfoldatefm.exe line, so it now reads:

//
Rename REGEXP PATTERN "(.+)(-|\s)(\d{6}|\d{8}|\d{2}-\d{2}-\d{4})(-|\s)(\d{6})\.(.+)" TO \1\\\0
"F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile} /p {sourcepath}
//


=

=
* SnagIt-08022014 071642.png (3.31 kB. 248x88 - viewed 380 times.)
=

This way I now only need to click on the [Exec All]  button.
Can this be avoided?

p.s. Donot know if the video will be uploaded alright, else see http://s528.photobuc...zpsc53a37d9.mp4.html
=
« Last Edit: February 08, 2014, 02:50 AM by dcwul62 »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
"F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile} /p {sourcepath}

Not going to work, the arguments /p {sourcepath} are what are passed to the locate32 program in the thread you mention.

SetFolDateFM.exe only has one option: /r

Try what I said, put Select ALLDIRS between Rename and SetFolDateFM:

Rename REGEXP PATTERN "(.+)(-|\s)(\d{6}|\d{8}|\d{2}-\d{2}-\d{4})(-|\s)(\d{6})\.(.+)" TO \1\\\0
Select ALLDIRS
"F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile}
« Last Edit: February 08, 2014, 06:09 AM by 4wd, Reason: DOpus command error. »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
Sel alldirs got me an error, unrecognized command or something.
the /p source thing, well, i just got that from that forumpost as apparently it could be used as a parameter or so.
there is a difference though between using it and nót using it.

below without /p {sourcepath}

http://s528.photobuc...zps647ba86d.mp4.html

One way or the other it has some effect ...  :)

=

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
One way or the other it has some effect ...  :)

Yes, but it's not going to do anything because this is what you're sending:

SetFolDateFM.exe /r sourcepath /p sourcepath

/r will be removed if it's there, therefore your final command line will be:

SetFolDateFM.exe sourcepath /p sourcepath

This is going to result in nothing happening since the folder /p doesn't exist, and sourcepath doesn't exist as a sub-directory of itself.

The reason the GUI appears is simple: there's at least 2 arguments in the command line (it doesn't matter what they are)

Also, my bad, the DOpus command is actually Select ALLDIRS but it still won't work because DOpus is executing the following line before the Select one can complete.

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
Bad luck then  :(
What I want is not possible.

Anyway, many many thanks for your support sofar!

=

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member

Héé ... 99% okay!  :Thmbsup:  :Thmbsup:

=
[attachmini=#][/attachmini]

http://s528.photobuc...zps37042f3e.mp4.html
=

When there is 1 folder, it is okay, only when there are more folders, then I need to click on [Exec All]
But this is already a big help!

THANKS!

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
I can probably tweak it to automatically do Exec All rather than Exec which will take care of it.

It'd still be better to use a variable derived from the filename in the Rename/SetFolDate commands - something that's likely to be rather easy under DOpus 11.

Otherwise a VBScript, (@script vbscript), would be possible - I might look at that.

EDIT: Tweaked, try 0.3.1.4
« Last Edit: February 08, 2014, 08:54 PM by 4wd »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
WONDERFUL !!

Many many thanks 4wd !  :Thmbsup: :Thmbsup:

This is really great and for a timesaver...

again
thanks!

=
http://s528.photobuc...zpsa7d7fcf1.mp4.html
=


dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
Oh, by the way ... it is perfect for me now (Opus)

where needed I added:

---
Select ALLDIRS
"F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile}
---

Without using this, i.e. whilst using SetFolDate in the 'normal' (conventional, non context menu way), it works fine as well.


Have not tested it with Total Commander (donot have that) and also I have not tested it with explorer.
Assume it will work fine with those as well.

=

best regards
=

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
See later post.

Here's an exercise in DOpus scripting, (only tested on DOpus 11 - actually it only works on DOpus 11):

Code: Text [Select]
  1. @script vbscript
  2. Option Explicit
  3.  
  4. Dim regex, file, folder, rencmd, sfdcmd, WshShell
  5.  
  6. Function OnClick(ByRef ClickData)
  7.   sfdcmd = "%programfiles%\GPSoftware\Directory Opus\SetFolDateFM.exe" ' Full path to SetFolDateFM.exe command
  8.  
  9.   Set WshShell = CreateObject("WScript.Shell")
  10.  
  11.   DOpus.OutputString "--- SetFolDate ---"
  12.   Set regex = New RegExp
  13.   With regex
  14.     .Pattern    = "^([^\.-]+).*" ' Change the RegExp to what you want
  15.     .IgnoreCase = true
  16.     .Global     = false
  17.   End With
  18.  
  19.   sfdcmd = Q(sfdcmd) & " /r " & Q(ClickData.func.sourcetab.path)
  20.   For Each file In ClickData.func.sourcetab.selected_files
  21.     If Not file.is_dir Then
  22.       Set folder = regex.Execute(file.name)
  23.       If folder.Count = 1 Then
  24.         rencmd = "Rename " & Q(file.name) & " TO " & Q(folder.Item(0).Submatches(0) + "\" + file.name)
  25.         DOpus.OutputString file.name + "|" + folder.Item(0).Submatches(0)
  26.         DOpus.OutputString rencmd
  27.         DOpus.OutputString "--------"
  28.         ClickData.func.command.RunCommand rencmd
  29.         sfdcmd = sfdcmd & " " & Q(folder.Item(0).Submatches(0))
  30.       End If
  31.     End If
  32.   Next
  33.   DOpus.OutputString sfdcmd
  34.   WshShell.Run(sfdcmd)
  35. End Function
  36.  
  37. Function Q(s)
  38.   Q = """" & s & """"
  39. End Function

2014-02-09 23_39_40.pngDONE: Change (sub) folder(s) date based on newest/oldest file in the folder

Get your RegExp correct and you can select every file and just hit the button.

BTW, you want to post your RegExp you're using on those commands?

Because I'm quite sure you could reduce the number commands you'd require.

eg. From this image here, you seem to be using 3 different commands presumably with RegExp Rename commands along these lines:

Rename REGEXP PATTERN "(.+)(-|\s)(\d{6}|\d{8}|\d{2}-\d{2}-\d{4})(-|\s)(\d{6})\.(.+)" TO \1\\\0

Whereas, a single command with the following RegEx should cover all 3 types of filenames:

Rename REGEXP PATTERN "^([^\.-]+).*" TO \1\\\0

Panorama.jpgDONE: Change (sub) folder(s) date based on newest/oldest file in the folder
« Last Edit: February 14, 2014, 07:17 PM by 4wd »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
Up front: sorry for the delay. Watching Olympics yesterday   :)

Currently I am still with the latest v10 of Opus, waiting for the release candidate or final, which will come soon I guess.

I have a number of items in my context menu, creating a Filenamed folder to copy or to move to.

For files with
date-time
seq.nbr-date-time
date  only
seq.nbr-date

above files are often a number screenshots, e.g. of program settings, or actions, etc.

and for files without date


=
SnagIt-10022014 121328.pngDONE: Change (sub) folder(s) date based on newest/oldest file in the folder
=

The regex things, they work fine.

SetFolDate works fine with the existing regex.

I tried with the other options, non-regex, but it did not work out there.

=
http://s528.photobuc...zpsbebae824.mp4.html
=

1st regex: Create Filenamed Folder to MOVE to... (Date+Time)
Rename REGEXP PATTERN "(.+)(-|\s)(\d{6}|\d{8}|\d{2}-\d{2}-\d{4})(-|\s)(\d{6})\.(.+)" TO \1\\\0
Select ALLDIRS
"F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile}

2nd regex: Create Filenamed Folder to MOVE to... (##-Date+Time)
Rename REGEXP PATTERN "(.+)(-|\s)(\d{2}|\d{3})(-|\s)(\d{6}|\d{8}|\d{2}-\d{2}-\d{4})(-|\s)(\d{6})\.(.+)" TO \1\\\0
Select ALLDIRS
"F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile}

3rd regex: Create Filenamed Folder to MOVE to... (Date Only)
Rename REGEXP PATTERN "(.+)(-|\s)(\d{6}|\d{8}|\d{2}-\d{2}-\d{4})\.(.+)" TO \1\\\0
Select ALLDIRS
"F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile}

4th regex: Create Filenamed Folder to MOVE to... (##-Date Only)
Rename REGEXP PATTERN "(.+)(-|\s)(\d{2}|\d{3})(-|\s)(\d{6}|\d{8}|\d{2}-\d{2}-\d{4})\.(.+)" TO \1\\\0
Select ALLDIRS
"F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile}

=
non-regex

1st one: Create Filenamed Folder to MOVE to...
Copy MOVE CREATEFOLDER "{dlgstringS|Name of Folder to move to...|{file$|noext}}"
Select ALLDIRS
"F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile}


the
           Select ALLDIRS
           "F:\Directory Opus\SetFolDateFM.exe" /r {ss} {allfile}

does not work here...

I have not yet testen your vbscript..  cause I am not sure..
Do you suggest I create this in the rename panel?
Actually I donot want to have too many buttons, reason why it is in the context menu with me.
Personally I think context menu items are much 'easier to work with' than buttons.

Anyway..

thanks for yr help!
=


« Last Edit: February 10, 2014, 05:34 AM by dcwul62 »

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member

In the above ( TO \1\\\0 )   the  '\0'  is the foldername.
can this be used as a variable?
 I don't know...  :(

together with set fn and select $fn , like in
http://resource.dopu...?t=15624&p=82452
or
http://resource.dopu...iewtopic.php?p=46176

Ah well, as said, I don't know..

dcwul62

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 336
    • View Profile
    • Donate to Member
By the way, do you know a way to batch update folderdates based on a date in the foldername?
Like:
FolderNameXYZ 10-02-2014         with folder modified date 01-12-2013

then folder modified date to be updated to 10-02-2014

This is a regular thing, sofar I always updated it manually using an attribute changer.
(requires a number of clicks and is one by one)

=