Highlighting folders that match the contents of a text file?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Megalith
Posts: 78
Joined: 24 Jan 2015 16:53

Highlighting folders that match the contents of a text file?

Post by Megalith »

Let's say I have a text file with the following list:

alfa
bravo
charlie

And I have a file directory with the following folders:

alfa
bravo
charlie
delta
echo

Is there a way I could run the text file through XYplorer and have it only highlight the folder names that match those in the text file (alfa, bravo, charlie)?

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Highlighting folders that match the contents of a text file?

Post by highend »

Code: Select all

    $content = readfile("<some path>\<file>.txt");
    $sel = "";
    foreach($line, $content, <crlf>, "e") {
        if (exists("<curpath>\$line") == 2) { $sel .= "<curpath>\$line<crlf>"; }
    }
    selectitems $sel;
One of my scripts helped you out? Please donate via Paypal

Megalith
Posts: 78
Joined: 24 Jan 2015 16:53

Re: Highlighting folders that match the contents of a text file?

Post by Megalith »

Thanks.

I also learned that this can be done with voidtools's Everything search.

Post Reply