Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2019-09

Feedback requested: File Search, a visual file search utility

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Anthony Walter

If anyone is interested I've posted another hopefully useful program along with the source.

https://www.getlazarus.org/apps/filesearch/

The File Search utility is a stand alone tool for Mac, Windows, and Linux to search for files using a variety of criteria including containing text, file size, and file dates. The full source code is available on github and it has no dependencies other than the LCL, so anyone should be able to compile with a default installation of Lazarus.

I believe the program is bug free and pretty much feature complete per my original idea. If anyone would like to leave a comment of make a suggestion I'd open to your ideas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190925/c459dd97/attachment.html>

Reply by email

Bart
to Anthony Walter
AM Anthony Walter wrote
The File Search utility is a stand alone tool for Mac, Windows, and Linux to search for files using a variety of criteria including containing text, file size, and file dates.

First of all: NICE!

You asked foor feedback.

You search the entire folder for each pattern in a loop (e.g. 10 patterns, 10 times a FindFirst/FindNext loop)..
Then you see if a given match already is in the list (with IndexOf, whic will be slow if you have lots of items).

An alternative would be to use a TMaskList and use it's MatchesMaks method (and search the folder with AllFilesMaks).
This way you can be sure no double entries will be found.

If the count of patterns is 1, then an optimization could be to not use a TMaskList but let the OS do the filtering with FindFirst/FindNext.

Using a TMaskList offers you the possibility to let the user decide wether the patterns are case-sensitive.
AFAICS, then as it is now, patterns are case-sensitive on *nix systems. This makes finding e.g. all JPEG's a bit awkward on those platforms (you would have to specify each and every possible mix of uppercase and lowercase spelling of '*.jpg;*.jpeg').

I recently adapted TShellTreeView/TShellTreeView to do it like that. (Previously it used a TAvlTree for this purpos, which is faster when searching than a TStringList)

Bart

Reply by email

Bart
to Bart
PM Bart wrote
An alternative would be to use a TMaskList and use it's MatchesMaks method (and search the folder with AllFilesMaks).

As you can see, my fingers struggle with the keyboard ;-) Everywhere it says *maks, you should read *mask.

Bart

Reply by email

Anthony Walter
to Bart: On Wed, Sep 25, 2019 at 7:33 AM Anthony Walter via lazarus First of all: NICE! You asked…

Thanks. I'll look into TMaskList. I assume you mean this bit of code?

https://github.com/alrieckert/lazarus/blob/master/components/lazutils/masks.pas

I am not sure how much this slows things down, and the checking if a file has already been added only happen on per directory basis, meaning the list is emptied with each folder and the search if already exists is reset to zero each time search enters a new folder. I will look into this though.

Thank you for your feedback.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190925/7ae3477e/attachment.html>

Reply by email

Denis Kozlov
to Anthony Walter: If anyone is interested I've posted another hopefully useful program along with the…

Hi Anthony,

It looks great!

If you were looking for new features, please consider the following features:

1. Show the snippets from the file where the content was found, with some context lines around the matches.
2. Allow specifying regular expressions for content search (optionally).

These are killer features that any file content search app must have in my opinion.

You can see an example implementation in AstroGrep (Windows only): http://astrogrep.sourceforge.net/screenshots/

Denis

Anthony Walter wrote 14 lines
If anyone is interested I've posted another hopefully useful program along with the source. https://www.getlazarus.org/apps/filesearch/ The File Search utility is a stand alone tool for Mac, Windows, and Linux to search for files using a variety of criteria including containing text, file size, and file dates. The full source code is available on github and it has no dependencies other than the LCL, so anyone should be able to compile with a default installation of Lazarus. I believe the program is bug free and pretty much feature complete per my original idea. If anyone would like to leave a comment of make a suggestion I'd open to your ideas.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190925/c957e6c3/attachment.html>

Reply by email

Anthony Walter
to Bart: On Wed, Sep 25, 2019 at 7:33 AM Anthony Walter via lazarus First of all: NICE! You asked…

Bart,

Thanks for suggesting TMaskList. I added it in and it works much better than the normal FindFirst pattern matching. It also allowed me to remove the duplicate checking.

Regarding TShellView, you might want to look at my Shell Control library. It is explorer for Windows, as well as a few other controls including a shell path with breadcrumb drop down menus, and a shell bubble type control for listing common folders. The source code is Windows only, but it's now available for free:

https://www.codebot.org/shell/
https://www.codebot.org/delphi/?doc=9613

and sources:

https://gitlab.com/sysrpl/codebot.shell

Feel free to modify the sources to work under Lazarus. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190927/81648603/attachment.html>

Reply by email