Page 1 of 1

Quicksearch result accumulates

Posted: 14 Sep 2022 21:20
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.

Re: Quicksearch result accumulates

Posted: 14 Sep 2022 21:34
by jupe
It is probably because your second line is a recursive search, of a recursive list of folders.

Re: Quicksearch result accumulates

Posted: 14 Sep 2022 21:36
by highend
It is^^ /n for the pattern and it's working as expected

Re: Quicksearch result accumulates

Posted: 14 Sep 2022 22:16
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:

Re: Quicksearch result accumulates

Posted: 19 Sep 2022 21:26
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.

Re: Quicksearch result accumulates

Posted: 19 Sep 2022 22:18
by klownboy
OK, it's because by definition, "contains" is only going to look at the subs for those two file types. DUH : :whistle: