Is there a way to select file matches with an 'older' created date using Sync Select ...or another method?
I need to be able to detect any files on either pane that have matching names and last modified dates, but have different (older) created dates.
Any help will be much appreciated!!
Sync Select to find OLDER created dates
-
highend
- Posts: 14926
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Sync Select to find OLDER created dates
A script should be able to do such stuff...
Code: Select all
end (!get("#800")), "No dual-pane mode active, aborted!";
$aItems = quicksearch("/nf", <curpath>, , "m");
$iItems = quicksearch("/nf", get("path", "i"), , "m");
end (!$aItems || !$iItems), "No file(s) in active or inactive pane, aborted!";
$aSel = "";
$iSel = "";
foreach($aItem, $aItems, <crlf>, "e") {
$item = gettoken($aItem, 1, "|");
$file = gpc($item, "file");
$esc = regexreplace($file, "([\\^$.+()\[{])", "\$1");
$match = regexmatches($iItems, "^.+\" . $esc . "\|.+?(?=\r?\n|$)");
if (!$match) { continue; }
$aMDate = gettoken($aItem, 3, "|");
$iMDate = gettoken($match, 3, "|");
if ($aMDate != $iMDate) { continue; }
$aCDate = gettoken($aItem, 4, "|");
$iCDate = gettoken($match, 4, "|");
if (datediff($iCDate, $aCDate, "s") <= 0) { continue; }
$aSel .= $item . <crlf>;
$iSel .= gettoken($match, 1, "|") . <crlf>;
}
end (!$aSel || !$iSel), "No match(es) found, aborted!";
selectitems $aSel, 4:="a";
selectitems $iSel, 4:="i";
status gettoken($aSel, "count", <crlf>) - 1 . " match(es) found...";
One of my scripts helped you out? Please donate via Paypal
-
DVD
- Posts: 5
- Joined: 26 Jul 2023 15:53
Re: Sync Select to find OLDER created dates
That's great - thanks so much for the effort!
I have tested, but the script just says "no match(es) found, aborted"
I have tested, but the script just says "no match(es) found, aborted"
-
highend
- Posts: 14926
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Sync Select to find OLDER created dates
and the files in the INACTIVE pane have the same name, same modified date and an OLDER created date?
Look at the image. The three selected files have the same name, same modified date but on the inactive pane a created date that's one minute older than the ones in the active pane...
Look at the image. The three selected files have the same name, same modified date but on the inactive pane a created date that's one minute older than the ones in the active pane...
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal
-
DVD
- Posts: 5
- Joined: 26 Jul 2023 15:53
Re: Sync Select to find OLDER created dates
I figured out what I was doing - it only works when the left pane is activated, not the right pane - no problem, but could it do both?
Also, please can you only highlight the oldest files on whichever side - so in your example, just the 3 files in the right pane would be highlighted.
Finally, to push my luck, is it possible to have an alternative version which ignores the modified date status - but still focuses on the oldest created date.
My sincere thanks for your efforts!!!
Also, please can you only highlight the oldest files on whichever side - so in your example, just the 3 files in the right pane would be highlighted.
Finally, to push my luck, is it possible to have an alternative version which ignores the modified date status - but still focuses on the oldest created date.
My sincere thanks for your efforts!!!
-
highend
- Posts: 14926
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Sync Select to find OLDER created dates
01. It does already work with both panes
02. Comment out the selectitems statement for the active pane?
03. Comment out the if () comparison for the ...MDate variables?
02. Comment out the selectitems statement for the active pane?
03. Comment out the if () comparison for the ...MDate variables?
One of my scripts helped you out? Please donate via Paypal
-
DVD
- Posts: 5
- Joined: 26 Jul 2023 15:53
Re: Sync Select to find OLDER created dates
Yep, it does work on both panes - I think there's something funky going on with my XYplorer - sorted now though.
Sorry to be a pain, but I tried the commenting out suggestion, but it doesn't identify which side is the oldest Created Date of the files in both panes.
Below is a mock up of what I'm trying to achieve. The goal is for whichever side I run the script, it highlights any file that has a matching name on the other pane (with/without same Modified Date) and highlights the file on each side which has the oldest Created Date...
...and ideally it would include folders too
Sorry to be a pain, but I tried the commenting out suggestion, but it doesn't identify which side is the oldest Created Date of the files in both panes.
Below is a mock up of what I'm trying to achieve. The goal is for whichever side I run the script, it highlights any file that has a matching name on the other pane (with/without same Modified Date) and highlights the file on each side which has the oldest Created Date...
...and ideally it would include folders too
To see the attached files, you need to log into the forum.
-
highend
- Posts: 14926
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Sync Select to find OLDER created dates
Code: Select all
end (!get("#800")), "No dual-pane mode active, aborted!";
$activePaneItems = quicksearch("/n", <curpath>, , "m");
$inactivePaneItems = quicksearch("/n", get("path", "i"), , "m");
end (!$activePaneItems || !$inactivePaneItems), "No file(s) in active or inactive pane, aborted!";
$activePaneSelection = "";
$inactivePaneSelection = "";
foreach($activePaneItem, $activePaneItems, <crlf>, "e") {
$item = gettoken($activePaneItem, 1, "|");
$file = gpc($item, "file");
$esc = regexreplace($file, "([\\^$.+()\[{])", "\$1");
$match = regexmatches($inactivePaneItems, "^.+\" . $esc . "\|.+?(?=\r?\n|$)");
if (!$match) { continue; }
// $activePaneModifiedDate = gettoken($activePaneItem, 3, "|");
// $inactivePaneModifiedDate = gettoken($match, 3, "|");
// if ($activePaneModifiedDate != $inactivePaneModifiedDate) { continue; }
$activePaneCreatedDate = gettoken($activePaneItem, 4, "|");
$inactivePaneCreatedDate = gettoken($match, 4, "|");
$difference = datediff($inactivePaneCreatedDate, $activePaneCreatedDate, "s");
// Younger
if ($difference < 0) {
$activePaneSelection .= $item . <crlf>;
// Older
} elseif ($difference > 0) {
$inactivePaneSelection .= gettoken($match, 1, "|") . <crlf>;
// Same date, select both
} else {
$activePaneSelection .= $item . <crlf>;
$inactivePaneSelection .= gettoken($match, 1, "|") . <crlf>;
}
}
end (!$activePaneSelection && !$inactivePaneSelection), "No match(es) found, aborted!";
selectitems $activePaneSelection, 4:="a";
selectitems $inactivePaneSelection, 4:="i";
status "Match(es) found...";
One of my scripts helped you out? Please donate via Paypal
-
DVD
- Posts: 5
- Joined: 26 Jul 2023 15:53
Re: Sync Select to find OLDER created dates
Superb - works like a charm - thanks v much!!!
...I've added something into your PayPal tip jar
...I've added something into your PayPal tip jar
-
highend
- Posts: 14926
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Sync Select to find OLDER created dates
Seen that, thanks 
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club