Multi Commander > Script
Select All Files matching the Date of File In Focus
(1/1)
AlanJB:
I have been using MC for about 2 weeks now & got my head around the configuration and even written a couple of custom commands.
Now I am stumped after a couple of days of scripting failure. I feel sure that what I want should be achievable with MultiScript, but I cannot get it to work.
I simply want to select all the files in the panel with a Last Modified Date that matches that of the file in focus.
Has anyone accomplished this or can give me some pointers?
TIA
Mathias (Author):
First I think you need to have a to and from date, you can not just do Date of File1 is equal to Date of File2, because filetime has a resolution of 1sec. (really 100ms but only 1s in script)
The MultiScript function GetFileTime(..) return time on seconds from 1970-01-01 00:00:00
If you want to match entire DATE.. like entire day.. then you need to calculate the start/end of the day and then use that as reference.
Use GetSourceItems(..)/GetTargetItems to get all items in a list
and GetTargetFocusPath (or Source) as the reference item
Mathias (Author):
If you need to figure out the start of a day based on a filedate, You need to do some math
Or you can make the program do it for you
--- Code: ---@var $filedate = GetFileTime( $PathToFile );
// Get date as string
@var $date = FormatDate( "yyyy-MM-dd" , $filedate );
// parse date to num value.
@var $startOfDay = ParseDateTime($date, "%Y-%m-%d");
--- End code ---
AlanJB:
Thanks Mathias.
FormatDate() was what I was missing.
Navigation
[0] Message Index
Go to full version