Folder name search

Older bugs which are supposed to be fixed in 0.84. *** Please try to reproduce your bug and confirm the bug fix. ***

Moderators: XnTriq, helmut, xnview, Dreamer

Rhea
Posts: 19
Joined: Sat Feb 23, 2019 3:59 pm

Folder name search

Post by Rhea »

Hello there,
I was trying to use the search function to find some folders until I realized... it's only for files? Or do I miss something? Thought it would come handy for handling the whole folder collection but I was wrong I guess 8)

Is this a planned function? Found some others threads a few years old, which describe the same problem.. :(

-Rhea-
User avatar
xnview
Author of XnView
Posts: 43833
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Folder name search

Post by xnview »

yes it's planned
Pierre.
Rhea
Posts: 19
Joined: Sat Feb 23, 2019 3:59 pm

Re: Folder name search

Post by Rhea »

Any news on the function?
aticus
Posts: 31
Joined: Tue Aug 23, 2022 3:30 pm

Re: Folder name search

Post by aticus »

Hi!

Any news on the function?
User avatar
michel038
XnThusiast
Posts: 1302
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Folder name search

Post by michel038 »

Since V0. 96 1, "Pathname" Is available in the search function, with some different operators ( is, is not, contains, ...)

I think that "Use catalog" option will increase search speed
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Folder name search

Post by helmut »

In XnView MP 1.02 I've just tried out searching for folders with a specific name. From what I can see the current search for "Pathname" is a start but the way it works it's not suitable for searching for folders.

Preparation/Note:
For searching for folders you have to activate "Recurse through subfolders". If you don't activate this checkbox the whole search doesn't make sense because current folder will be searched, only.

Some problems that I see:
  • If you specify "Programs" as pathname, nothing will be found unless you change the comparator "is" to comparator "contains". Reason is that the full pathname is compared with your search text and "C:\Programs" doesn't equal to "Programs". But then, not only "Programs" folder is found but all subfolders are found, too, because they also contain "Programs" (e.g. "C:\Programs\XnView").
  • If you search for folders with a specific name "PDF", folders with this name will be found but also folders including files containing "PDF" (e.g. "C:\Programs\java\PDFconstants.java").
  • If you search for folders with a specific name (e.g. "PDF"), all folders with this name and all subfolders will be listed.
  • If add a backslash to your search name (e.g. "\PDF") nothing will be found.

Summary
Above I've listed just some problems/limitations of the search criteria "Pathname" that I see - I guess there are many more. Search criteria "Pathname" makes sense for including and excluding specific paths but for searching for folders with specific names it's useless.

My suggestions:
  • Add a search option "Folder" that searches for folders with that specific name.
  • Make search criteria "Pathname" search the path without filename (not: path with filename)
User avatar
michel038
XnThusiast
Posts: 1302
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Folder name search

Post by michel038 »

I'm waiting to hear if Pierre can develop Helmut's excellent suggestions, otherwise I can offer a workaround with BAT files for Windows.


It's a bit tricky , something like :

1) create a TXT file containing the list of your directories :
cmd
Dir /ad /b /s > C:\XNVIEWMP\DirList.txt
(You will need to renew this file when folders are added)

2) create a BAT file searching for a <word> in this list
@echo off
:aa
set /p word= Enter a word to search
find /i "%word%" "C:\XNVIEWMP\DirList.txt"
goto aa

3) Add a shortcut in your toolbar linked to the bat file ...
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Folder name search

Post by helmut »

michel038 wrote: Sun Aug 28, 2022 6:03 pm I'm waiting to hear if Pierre can develop Helmut's excellent suggestions, otherwise I can offer a workaround with BAT files for Windows.
Your batch script (BAT file) is a good thing, thanks for sharing it, Michel. Just to make sure: My "excellent suggestions" above will help to allow for adding "Folder" as search criteria but even with these changes XnView's search will remain a search for files and not a search for folders. A search for folders is something completely different and would require several changes to the current dialog, I think.

Perhaps, Windows Explorer can also be used for searching folders with specific names:
MS Explorer allows for searching elemtents including folders, filenames. I'm not 100% sure but I think it should be possible to search for folders, only. Following webpage offers lots of infos (which I haven't read, yet): https://www.informit.com/articles/artic ... &seqNum=16
I've tried "abc type:=folder" to find folders, only, but this search finds files with "abc", too. Perhaps someone else can help here.
User avatar
michel038
XnThusiast
Posts: 1302
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Folder name search

Post by michel038 »

I tried a new method :
I added a category ("Folder") on all my folders.
In categories filter, when "Folder" is selected, all folders are shown. With "Quick search", I can instantly find any word I'm looking for in folder names ...
And double click on the result to browse it .

In addition, a "Description" can be added to each folder (Right click, Edit Comment or Ctrl D) , use descript.ion file and not embedded comment.
Trick to be quicker
- Create a description with a single character "x" for all selected folders (in the parent folder)
- Edit the decript.ion hidden file with a notepad, and add some words for each folder, instead of "x"
Then the quick search will instantly find searched folders containing some strings in their name and in their description.
FKCapitalism2
Posts: 249
Joined: Sun Apr 23, 2023 5:14 am

Re: Folder name search

Post by FKCapitalism2 »

xnview wrote: Wed Apr 17, 2019 7:26 amyes it's planned
Hope you can implement this sooner than later, lack of this functionality really holds me back right now.

michel038 wrote: Tue Sep 27, 2022 1:26 pm I tried a new method :
I added a category ("Folder") on all my folders.
In categories filter, when "Folder" is selected, all folders are shown. With "Quick search", I can instantly find any word I'm looking for in folder names ...
And double click on the result to browse it .

In addition, a "Description" can be added to each folder (Right click, Edit Comment or Ctrl D) , use descript.ion file and not embedded comment.
Trick to be quicker
- Create a description with a single character "x" for all selected folders (in the parent folder)
- Edit the decript.ion hidden file with a notepad, and add some words for each folder, instead of "x"
Then the quick search will instantly find searched folders containing some strings in their name and in their description.
Unfortunately this method would require to first locate every single folder before assigning it a category which is what i wanted to avoid in first place.
User avatar
michel038
XnThusiast
Posts: 1302
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Folder name search

Post by michel038 »

Search on paths is case sensitive although this option is not enabled (this option only applies to the filenames)

Right, "Search" is intended to find files ...
When a word matches a part of a pathname , all file names that are in that folder will be shown.
But if the folder is empty, it won't be shown

Test in a cmd window :

Code: Select all

Dir D:\Photos /s /ad /b | find /i "washington"
will show all subfolder names of D:\photos containing Washington

Using a .bat file:

Code: Select all

@echo off
:aaa
set /p word="String to search : "
if "z%word%"=="z" goto bbb
Dir D:\Photos /s /ad /b | find /i "%word%"
goto aaa
:bbb
then you can add a new button in the toolbar, linked to this bat file ...
but in this way, we cannot mix searches with other criteria. :x
FKCapitalism2
Posts: 249
Joined: Sun Apr 23, 2023 5:14 am

Re: Folder name search

Post by FKCapitalism2 »

michel038 wrote: Wed Oct 04, 2023 8:49 pmthen you can add a new button in the toolbar, linked to this bat file ...
Is that right way to do it?

Image

After doing this i get CMD window with list of folder, they not display in XnViewMP interface thus thumbnails don't get loaded for them.
Image
FKCapitalism2
Posts: 249
Joined: Sun Apr 23, 2023 5:14 am

Re: Folder name search

Post by FKCapitalism2 »

michel038 wrote: Wed Oct 04, 2023 8:49 pmthen you can add a new button in the toolbar, linked to this bat file ...
Could you provide more information please.
User avatar
michel038
XnThusiast
Posts: 1302
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Folder name search

Post by michel038 »

Yes, sorry... If you have got the result in the CMD window, it's the right method.
We can't get a best result with this method.
I thought you were looking for some folders, lost somewhere in the file's tree. (I'm naming my folders with some words that can describe the place, the event or the content. It's helpful to find a photo with incomplete memories)
In cmd environment, you can redirect the result to a text file by adding >file.txt at the end of the command.
Don't know if this can help.
Dir D:\Photos /s /ad /b | find /i "%word%" > C:\doc\result1.txt

I'll be back in about 10 days...
User avatar
user0
XnThusiast
Posts: 1646
Joined: Sat May 09, 2015 9:37 am

Re: Folder name search

Post by user0 »

there is free, portable app in active development that search instantaneously:
Everything from voidtools.com

you can set it up to filter results by type, eg folder, images.. etc.