Visual Filters and Variables for Subfolder Name

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
GreetingsFromPoland
Posts: 206
Joined: 29 Sep 2022 14:20

Visual Filters and Variables for Subfolder Name

Post by GreetingsFromPoland »

hi! i have a folder and file structure like this :

\Artwork\(subfolder)\(subfolder)_marquee.png
\Artwork\(subfolder)\(subfolder)_cpo.png
\Artwork\(subfolder)\otherfile.png
\Artwork\(subfolder)\anotherfile.png

for example,
\Artwork\dkong\dkong_marquee.png

basically inside of each subfolder there are several files that match "subfolder name" + "_*.png". there are tons of other files in there, but i'm trying to select only the ones that match the name of the subfolder with the underscore.

i start in the \Artwork folder and do a *.png search and get everything in Search Results (i see the Path column there as well). i tried setting the Visual Filter to <curtab> but that didn't work (it did work if i was inside of a folder and started a search, but not at the root).

next i tried path:<curtab> and that didn't work either.

within the Search Results tab, is it possible to filter just the files that match "the name of the folder it's in" then i can add "_*.png" to it ?

i'm still going through the help file sections for XY Variables and Visual Filters to see if i can find something. i love using the Search Results because i can use the awesome Rich Copy to recreate the structure when i copy/move the files to a different location.

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

Re: Visual Filters and Variables for Subfolder Name

Post by highend »

<curtab> in a search result? Doesn't make sense at all.
<curfolder> would come close but for whatever reason it doesn't display the correct result for an entry
Don't know if this is just a bug or by design...

Scripting it would be probably the only solution
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

GreetingsFromPoland
Posts: 206
Joined: 29 Sep 2022 14:20

Re: Visual Filters and Variables for Subfolder Name

Post by GreetingsFromPoland »

hi!
<curtab> in a search result? Doesn't make sense at all.
i was trying all the different path-y related entries to see if any would work.
<curfolder> would come close but for whatever reason it doesn't display the correct result for an entry
Don't know if this is just a bug or by design...
let's call it a bug so admin can fix it !

when looking at the help, there are SO MANY options for Visual Filters, surely getting just the folder name of the item would have to be included.

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

Re: Visual Filters and Variables for Subfolder Name

Post by highend »

Even without a vf it's incredible easy to script...

Code: Select all

    $report = report("{fullpath}|{name}<crlf>");
    $files  = "";
    foreach($item, $report, <crlf>, "e") {
        $fullPath = gettoken($item, 1, "|");
        $path     = gettoken($fullPath, -1, "\");
        $name     = gettoken($item, 2, "|");
        if ($name LikeI $path . "_*") { $files .= $fullPath . "\" . $name . <crlf>; }
    }
    if ($files) { paperfolder("Result", $files); }
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

GreetingsFromPoland
Posts: 206
Joined: 29 Sep 2022 14:20

Re: Visual Filters and Variables for Subfolder Name

Post by GreetingsFromPoland »

amazing! worked perfectly. allowed me to easily copy 4GB out of the 12GB folders. thank you !

eil
Posts: 1606
Joined: 13 Jan 2011 19:44

Re: Visual Filters and Variables for Subfolder Name

Post by eil »

highend wrote: 09 Feb 2024 23:04 if ($name LikeI $path . "_*") { $files .= $fullPath . "\" . $name . <crlf>; }
Can you please explain marked commands?
I presume .= means "add the next data to end of variable's content", but i don't seem to ever see LikeI command.
Win 7 SP1 x64 100% 1366x768

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

Re: Visual Filters and Variables for Subfolder Name

Post by highend »

Code: Select all

=> Compound Assignment Operators
rtfm "idh_scripting.htm";

rtfm "idh_scripting.htm#idh_scripting_comparisons";
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

GreetingsFromPoland
Posts: 206
Joined: 29 Sep 2022 14:20

Re: Visual Filters and Variables for Subfolder Name

Post by GreetingsFromPoland »

hi admin! is there any way that you can take a look at what highend mentions :
<curfolder> would come close but for whatever reason it doesn't display the correct result for an entry
Don't know if this is just a bug or by design...
i have been able to use his script without any problems. would like to hear your input if this is a potential bug or not (when using the variables.

admin
Site Admin
Posts: 60117
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Visual Filters and Variables for Subfolder Name

Post by admin »

Sure, but where does <curfolder> go wrong?

GreetingsFromPoland
Posts: 206
Joined: 29 Sep 2022 14:20

Re: Visual Filters and Variables for Subfolder Name

Post by GreetingsFromPoland »

i was trying to use the path: name (shown in the results) as part of the visual filter. something like this : path:<curfolder>.png; but i can't get anything to match the path name that is shown.

example folder structure :
\artwork\dkong
\artwork\frogger
\artwork\mspacman

for example, searching for *.png would give me something like this :
(these are from the dkong subfolder and the Path column shows dkong)
dkong.png
dkong_marquee.png
dkong_flyer.png
(these are from the frogger subfolder and the Path column shows frogger)
frogger.png
frogger_cpanel.png
frogger_cabinet.png
(etc)

then on the Search results tab, i would use path:<curfolder>.png as the Visual Filter and hopefully only see :
dkong.png
frogger.png
since the file name matches the path + .png.

i'm probably doing it wrong, but i can't seem to use the result of Path in any filter. i've tried several XY variables in the filter.

admin
Site Admin
Posts: 60117
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Visual Filters and Variables for Subfolder Name

Post by admin »

If you want to match filenames you should use name:<curfolder>.png.

But this won't help you in deep search results. <curfolder> does not resolve per item but per list.

GreetingsFromPoland
Posts: 206
Joined: 29 Sep 2022 14:20

Re: Visual Filters and Variables for Subfolder Name

Post by GreetingsFromPoland »

thanks. good to know for future searches.
<curfolder> does not resolve per item but per list.
ok, this is by design. i'm guessing it wouldn't be an easy task to update it to work with per item, right ?

for my previous task, i used highend's script and it did the trick.

admin
Site Admin
Posts: 60117
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Visual Filters and Variables for Subfolder Name

Post by admin »

Per-item variables?* No, that would be overkill. Such things are better handled by scripting.

* we have them, but only in the special context of custom columns

Post Reply