What script should I use to compare active pane vs inactive and delete dupes

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
herbertofury
Posts: 1
Joined: 10 Oct 2022 18:10

What script should I use to compare active pane vs inactive and delete dupes

Post by herbertofury »

I just want to delete dupes by filename and not size, I am a little special, so I don't know how to modify this script to do that
$includeFileTypes = "*.package";

$activePane = folderreport("files:{fullname}::{size RAW}:{name}", "r", get("Path", "a"), , , "|");
$activePane = formatlist($activePane, "f", "|", "$includeFileTypes", "f");

$inactivePane = folderreport("files:{fullname}::{size RAW}:{name}", "r", get("Path", "i"), "r", , "|");
$inactivePane = formatlist($inactivePane, "f", "|", "$includeFileTypes", "f");

$delete = "";
foreach($file, $inactivePane) {
$fileNameOnly = gettoken($file, 1, "::");
$identifier = regexreplace(regexreplace($file, "([\\\[\]^$.+(){}])", "\$1"), "(.*?::)(.*?)", "$2");
$match = regexmatches($activePane, $identifier);
if ($match) { $delete = $delete . "<curpath>\" . getpathcomponent($fileNameOnly, "file") . "|"; }
}
delete 1, 0, $delete;

I was also wondering how to make this script select the color it matches or sort them in any way
// Highlight item(s) in the active pane that are missing in the inactive one
$color = "FFFFFF,FF0000"; // White font, red background

end (get("#800") != 1), "Dual pane not active, aborted!";

$active = listpane(, , 4, <crlf>);
$inActive = listpane("i", , 4, <crlf>);
$result = formatlist($active, "F", <crlf>, "!$inActive");

if ($result) {
$filter = formatlist($result, "q", <crlf>);
$filter = regexreplace($filter, "^(.)", "name:$1");
$filter = regexreplace($filter, "([""])$", "$1>$color");
colorfilter($filter, <crlf>);
}

If selectfiles was a part of the language this would be much easier to do and don't understand why its not included or some way to sort files by color tag. I was also wondering if is possible to only show dupe files during comparison. Please don't respond with just use dupe file search, as it's not doing what I wish to accomplish. I am trying to get some form of sync select to work while in the find files menu. syncselect does not work in the find files menu for some stupid reason. Any help is much appreciated.

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

Re: What script should I use to compare active pane vs inactive and delete dupes

Post by highend »

Put your code in code tags^^
ct.png
ct.png (7.31 KiB) Viewed 161 times

Code: Select all

    $includeFileTypes = "*.package";

    $activePane = folderreport("files:{fullname}::{name}", "r", get("Path", "a"), , , "|");
    $activePane = formatlist($activePane, "f", "|", "$includeFileTypes", "f");

    $inactivePane = folderreport("files:{fullname}::{name}", "r", get("Path", "i"), "r", , "|");
    $inactivePane = formatlist($inactivePane, "f", "|", "$includeFileTypes", "f");

    $delete = "";
    foreach($item, $inactivePane) {
        $path       = gettoken($item, 1, "::");
        $identifier = gettoken($item, 2, "::");
        $escaped    = regexreplace($identifier, "([\\\[\]^$.+(){}])", "\$1");
        $match      = regexmatches($activePane, $escaped);
        if ($match) { $delete .= "<curpath>\" . getpathcomponent($path, "file") . "|"; }
    }
    delete 1, 0, $delete;
how to make this script select the color it matches
selectitems() on $result?
sort them in any way
sortby?
If selectfiles was a part of the language
selectitems()...
to sort files by color tag
What exactly is a color tag?
One of my scripts helped you out? Please donate via Paypal

Post Reply