Page 1 of 1

How to compare two filter selectors e.g. "dateC: > dateM: "

Posted: 03 Aug 2021 20:08
by Yusuke・R86
Hello everybody!

I am a new XYplorer user and I am trying it out, I have many personal files and folders with the creation date greater than their modification date this was because I copied the files without preserving their creation date.

To fix this a bit I am trying to compare the modification date and creation date of all my personal files to detect which ones they are and then copy the modification date into the creation date field.

I have tried to create some visual filters but without success trying with "dateC: > dateM: " without quotes but I don't know if I'm missing something.

I have read the help manual and searched the forum, but I can't figure out how to compare two selectors as this case is very exceptional.

Is it possible to create such a visual filter in XYplorer?

Thank! :kidding:

Re: How to compare two filter selectors e.g. "dateC: > dateM: "

Posted: 03 Aug 2021 20:31
by highend
You can automate the whole process...

Go into the folder where all these files and folders are and then copy the script and paste it into
Menu - Scripting - Run Script...

and hit the OK button

Code: Select all

$items = quicksearch(, , , "sm");
    $list  = "";
    foreach($item, $items, <crlf>, "e") {
        $path  = gettoken($item, 1, "|");
        $dateM = gettoken($item, 3, "|");
        $dateC = gettoken($item, 4, "|");

        if (compare($dateC, $dateM, "d") == 1) {
            $list .= $path . <crlf>;
        }
    }
    $list = trim($list, <crlf>, "R");
    if ($list) {
        if (confirm("Change date for " . gettoken($list, "count", <crlf>) . " item(s)?")) {
            timestamp "c", '*', $list, "m";
        }
    }

Re: How to compare two filter selectors e.g. "dateC: > dateM: "

Posted: 04 Aug 2021 10:36
by Yusuke・R86
Wow! this works perfectly, it even changes the date without having to use third party programs, but just out of curiosity would it be possible to list, filter or display by name the items before modifying the date?

Thanks for your time :kidding:

Re: How to compare two filter selectors e.g. "dateC: > dateM: "

Posted: 04 Aug 2021 10:44
by highend
Replace

Code: Select all

    if ($list) {
        if (confirm("Change date for " . gettoken($list, "count", <crlf>) . " item(s)?")) {
            timestamp "c", '*', $list, "m";
        }
    }
with

Code: Select all

    if ($list) {
        tab("new");
        paperfolder("Wrong created dates", $list);
        if (confirm("Change date for " . gettoken($list, "count", <crlf>) . " item(s)?")) {
            timestamp "c", '*', $list, "m";
        }
    }

Re: How to compare two filter selectors e.g. "dateC: > dateM: "

Posted: 04 Aug 2021 12:53
by Yusuke・R86
Great! works like a charm! :kidding: :appl: