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

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Yusuke・R86
Posts: 3
Joined: 03 Aug 2021 19:41

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

Post 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:

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

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

Post 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";
        }
    }
One of my scripts helped you out? Please donate via Paypal

Yusuke・R86
Posts: 3
Joined: 03 Aug 2021 19:41

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

Post 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:

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

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

Post 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";
        }
    }
One of my scripts helped you out? Please donate via Paypal

Yusuke・R86
Posts: 3
Joined: 03 Aug 2021 19:41

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

Post by Yusuke・R86 »

Great! works like a charm! :kidding: :appl:

Post Reply