It's a difficult question. I donโt remember any instance of non-indexed search showing a progress bar. (Can someone prove their mistake to me?)
I would suggest the following method (an extension of the Benny Hallett proposal) that could provide a greater degree of detail.
Suppose you are looking for a specific file name pattern for the entire file system (for example, in unix, to search for all * .jpg files in /)
Start by dividing the execution line into N parts (where N is the number of directories in the root path of your search).
Each time you delve into the heirachy directory, the total length of the process line that has been assigned to the parent directory is divided by the number of subdirectories contained. When the catalog search is completed, the part that was provided to it is added to the progress bar. In even more detail, you can divide the selection by the number of files + directories in the current directory.
This method should ensure that you only need to go through the directory structure once and better handle uneven directories. (Unevenly, I mean a mixture of directories with high and low search costs)
As an example, suppose the following directory structure:
/ clipart photos family holiday wallpapers anime landscapes
(each indentation indicates a level deeper in the directory tree and suggests that all directory traversal is performed in alphabetical order)
You start by viewing the '/' and you see that there are three directories (clipart, photos and wallpapers), and therefore you first divide the progress bar into one third.
Then you look for the directory in the directory, and when done, update your progress bar to one-third. Then you go inside the photos and see that there are two subdirectories. This means that when you finish the search in the family, you add one sixth to the progress bar, since there are two subdirectories (family and holiday), and the progress for each of them is half one third allocated for photos.
So in short:
clip completion adds one third
completion of a photo / family adds one masterpiece
completion of photos / holidays adds one masterpiece
the completion of the wallpaper / anime adds one masterpiece
the completion of wallpaper / landscape adds one masterpiece
Total 1.0 (or 100%) (ignoring floating point precision)