Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature: Find Files #222

Closed
shundhammer opened this issue Nov 8, 2023 · 1 comment
Closed

New Feature: Find Files #222

shundhammer opened this issue Nov 8, 2023 · 1 comment
Labels

Comments

@shundhammer
Copy link
Owner

shundhammer commented Nov 8, 2023

Overview

"Find..." is a new feature to search the in-memory directory tree for files and directories by name. The search results are listed in a separate non-modal window that you can use to jump in the main window from one result to the next, opening that branch and scrolling to it.

Just like the results of the "Discover..." actions, you can keep the results window open and still work in the main window. You can start cleanup actions in the main window, or even in the results window directly.

Screenshots

QDirStat-find-files-01

QDirStat-find-files-results

QDirStat-find-files-dialog

Search modes include:

  • Contains
  • Starts with
  • Ends with
  • Exact match
  • Wildcard (like in the shell)
  • Regular expression
  • Auto

"Auto" will guess what you probably mean; if ^ or $ or .* is found, it will guess regexp, for a lone * or *.* it will guess wildcard. If the search pattern starts with = (e.g. =foobar), exact match is enforced.

Notice that this always uses the name (with extension, if there is any), not the complete path.

The search results are limited to 1000.

@shundhammer shundhammer added the doc label Nov 8, 2023
@shundhammer
Copy link
Owner Author

shundhammer commented Nov 10, 2023

Use Case: Examining Browser Extensions

So Opera, my favorite Internet browser, decided to dump 549 MB (!!!) into my home directory that even clearing its caches won't remove. What is all that stuff? 71.9 MB just for browser extensions?!

Unfortunately, those browser extensions don't use a name for their directories that would be easily recognizable; instead, they use a long, cryptic alphanumeric ID.

Those browser add-on packages each have a file manifest.json that describes it. So let's have a look at those, using QDirStat's new "Find" feature.

I selected the ~/.config/opera/Default/Extensions directory and started a file search from there (Menu Edit -> Find... or Ctrl-F) for files named manifest.json:

QDirStat-extensions-manifest

I rearranged the windows to make it look a bit tidier: I moved and resized the Search Results window to take the space of the lower part of the QDirStat main window with the treemap.

I also added a custom cleanup action that simply does a cat on a file, and I configured it to always open the output window; that means that I can scroll and even zoom in a normal cat output:

QDirStat-showing-manifest

So that fat browser extension bbkekonodcdm... that eats away 24.9 MB is Ghostery. Hmm... do I really need it? Does it give me more than uBlock Origin which is my primary adblocker?

...ok, going through the other fat extensions...

As you can see, I can leave the Search Results window open while I work in the main window; I can examine files there, I can start cleanup actions (that even works from the Search Results window: It has the same context menu for each entry as the main window), I can move from one search result to the next, and it will scroll to it in the main window, open that branch and select it so I can see the details of that file (or directory) right away.

Try it.

Mozilla Extensions (Firefox, Thunderbird)

Mozilla uses a similar directory structure for its extensions, but it packs each of them into a .xpi file which is just a .zip file (why they don't simply name them .zip is anyone's guess).

Mozilla-extensions

But unlike Chrome / Chromium / Opera extensions, the name of those .xpi files give some hints what they are, and they are not anywhere as fat as those Opera / Chrome extensions (Opera uses the Chrome engine; it's just a nicer user interface around that engine).

Copying such a .xpi to a tmp directory and extracting it with unzip shows the structure, and it also has a manifest.json file that we could look into. But since the filename of the .xpi is already clear enough, that's not even necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant