Quicksearch result accumulates

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Quicksearch result accumulates

Post by klownboy »

Hopefully not another stupid question, but probably is, I'm using quicksearch to get a listing of all "ini" files in a folder including subs but only those folders which contain both "ini" and "dbits" files. So, first I find all the folders that contain both "ini" and "dbits" files:
$folders = quicksearch("prop:#contains.*.ini:1 AND prop:#contains.*.dbits:1", $sel_drive); //works fine
Then I'm using something like this:
$ini = quicksearch("*.ini", $folders);
where I want a listing of all the ini files in the above folders ($folders). My problem is, in the listing for $ini in the last or "Three" folder, I get a listing of the same "ini" file twice. I'm quite sure it has to do with the fact that ini file is being listed once for the number "Two" subfolder and then again for the "Three". The folder structure being: the base folder "One", under it is sub folder "Two", and under subfolder "Two" is subfolder "Three". Each folder has only one ini file contained in it.

I don't believe it's a bug, but is there some switch that would prevent the ini file in folder "Three" from appearing twice in the listing with exactly the same folder and filename? In this case, essentially each folder should be treated independently not accumulating. Or should I be using a different method entirely? (I know the listing is for folders "Two" and "Three"). Thanks.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

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

Re: Quicksearch result accumulates

Post by jupe »

It is probably because your second line is a recursive search, of a recursive list of folders.

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

Re: Quicksearch result accumulates

Post by highend »

It is^^ /n for the pattern and it's working as expected
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Quicksearch result accumulates

Post by klownboy »

Ok thanks jupe and highend. Since in this case, $folders is a list of folders, I can use the /n switch because the search for ini files is performed on each folder is treated independently. Thanks, that works. :tup:
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Quicksearch result accumulates

Post by klownboy »

I'm experiencing an issue with this same quicksearch discussed earlier where $paths is a listing of folders that I'd like to determine which of these folders contain both ini and dbits files. For some reason the parent folder is never listed in the resultant ($folders) even though the parent definitely has both an ini file and a dbits file. It lists the subfolders properly but not the main or parent. I've tried using "|" and <crlf> as the separator in $paths and it made no difference.

$folders = quicksearch("prop:#contains.*.ini:1 AND prop:#contains.*.dbits:1 /n", $paths);
$paths is a "temp" folder with both ini and dbits files and under "temp" is another folder with both and under it another with both. At first, I thought the issue may have been been due to the fact that the parent folder was backslashed, but I removed the backslash and I still get the same result.

Why shouldn't this be picking up the parent folder along with all the subfolders? Is it a bug or am I missing something in the syntax? Thanks.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Quicksearch result accumulates

Post by klownboy »

OK, it's because by definition, "contains" is only going to look at the subs for those two file types. DUH : :whistle:
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Post Reply