A way to get a single sample from each folder. How?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Slideshow BoB
Posts: 41
Joined: 03 Apr 2024 18:46

A way to get a single sample from each folder. How?

Post by Slideshow BoB »

Hello guys.

Is there a way I could have a single image sample from each subfolder out of a major one? The oldest one, if posible, the output being listed as thumbnails OR as a simple list of files.

A filter out for files under '.thumbnails' folders would be awesome, targeting main folders named 'screenshots' would be cooler.
Thanks in advance.

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

Re: A way to get a single sample from each folder. How?

Post by highend »

Quicksearch with /types={:Image} /limitperdir=1
=> Not the oldest one

Code: Select all

    $folders = quicksearch("/d", , , "s");
    $result  = "";
    foreach($folder, $folders, <crlf>, "e") {
        $files = quicksearch("/n /types={:image}", $folder, , "sm");
        $files = regexreplace($files, "^(.+?)\|(.+?)\|(.+?)\|(.+?)\|(.+?)\|(.+?)(?:\r?\n|$)", "$4|$1<crlf>");
        $files = formatlist(trim($files, <crlf>), "s", <crlf>);
        if ($files) { $result .= gettoken(gettoken($files, 1, <crlf>), 2, "|") . <crlf>; }
    }
    text $result;
One of my scripts helped you out? Please donate via Paypal

Slideshow BoB
Posts: 41
Joined: 03 Apr 2024 18:46

Re: A way to get a single sample from each folder. How?

Post by Slideshow BoB »

fantastic. many thanks.
appending paperfolder(test, $result); to the code made me a usable list.

".thumbnails" folders are being diisplyed among results. Is there a way to exclude them? It's still a +1000 items bulk. :shock:

jupe
Posts: 3446
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: A way to get a single sample from each folder. How?

Post by jupe »

I think you could achieve what you want in an alternative way, should only be a one line script, incl the .thumbnails/screenshots criteria, let me know if you're still interested and I could write up an example.

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

Re: A way to get a single sample from each folder. How?

Post by highend »

If you want to prefilter for screenshots folders only, just change the first quicksearch() command:
$folders = quicksearch("screenshots /d", 3:="s");
One of my scripts helped you out? Please donate via Paypal

Slideshow BoB
Posts: 41
Joined: 03 Apr 2024 18:46

Re: A way to get a single sample from each folder. How?

Post by Slideshow BoB »

jupe wrote: 18 Jun 2025 21:07 I think you could achieve what you want in an alternative way, should only be a one line script, incl the .thumbnails/screenshots criteria, let me know if you're still interested and I could write up an example.
if you don't mind, sure, I'd like to have another approach for this to happen. Many thanks!

Slideshow BoB
Posts: 41
Joined: 03 Apr 2024 18:46

Re: A way to get a single sample from each folder. How?

Post by Slideshow BoB »

highend wrote: 19 Jun 2025 06:08 If you want to prefilter for screenshots folders only, just change the first quicksearch() command:
$folders = quicksearch("screenshots /d", 3:="s");
thank you, I'll sure give it a try.

is there a way to suppress the distractive notification-bombing happening while the list is build?

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

Re: A way to get a single sample from each folder. How?

Post by highend »

Don't use the "s" argument for quicksearch?
One of my scripts helped you out? Please donate via Paypal

jupe
Posts: 3446
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: A way to get a single sample from each folder. How?

Post by jupe »

Something like this is what I was thinking:

Code: Select all

goto "vi:" . regexreplace(quicksearch("{:Image} /lpd=1 /paths=*\screenshots\* /excl=.thumbnails /p"), "^(.+?)$", '<pick 1.mr/{:Image} ''$1''>'); view(6);
It may need modifying a little, I was unsure if you ony want direct descendants of screentshot folders, or if it could be anywhere in the path hierarchy.

Slideshow BoB
Posts: 41
Joined: 03 Apr 2024 18:46

Re: A way to get a single sample from each folder. How?

Post by Slideshow BoB »

I managed to make some progress here by combining both ideas for better outputs' handling (thanks for that, jupe!).
But I'm missing a way to set a certain combination of columns in a specific order each time I ask for a Details view (view 0). Is there a way to achieve this, guys?

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

Re: A way to get a single sample from each folder. How?

Post by highend »

setcolumns()?
One of my scripts helped you out? Please donate via Paypal

Slideshow BoB
Posts: 41
Joined: 03 Apr 2024 18:46

Re: A way to get a single sample from each folder. How?

Post by Slideshow BoB »

highend wrote: 06 Oct 2025 15:52 setcolumns()?
I must admit Help entry is being of no help to me.
Reading "Soft Columns" entry got me even more dizzy.

For instance, how can I set a "number / name / size / mod desc / created" using setcolumns?

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

Re: A way to get a single sample from each folder. How?

Post by highend »

The very first example shows how you set such columns and sortby can sort them afterwards...
One of my scripts helped you out? Please donate via Paypal

Slideshow BoB
Posts: 41
Joined: 03 Apr 2024 18:46

Re: A way to get a single sample from each folder. How?

Post by Slideshow BoB »

I believe cursing is forbidden around here, as I also like to present myself as an elegant person myself.

So please, picture Severance's Dylan G expressing gratitude appended and followed by some of his well known populace vocabulary. Instead being concise as mr. Milcchick was told to be, 'tks a bunch!'

Post Reply