dutree icon indicating copy to clipboard operation
dutree copied to clipboard

[FEATURE] Filtering by extension/pattern?

Open polarathene opened this issue 6 years ago • 4 comments

I see there is the -x option, but no example.

-x, --exclude NAME exclude matching files or directories

It only accepts full filename? Would it be possible to support matching a filter pattern? -p --pattern PATTERN Where you can use a pattern for filtering the results via globs, include/exclude extensions *.webp,*.jpg(only match these), or exclude *.gif,preview*.

In my case, I just wanted to identify results with a certain file extension, doesn't seem possible currently?

Thanks for the great tool, it's been helpful, using some native system commands on a server wasn't working in large directories, either raising an error that the arg list was too long, or being unresponsive for a long time with no feedback. dutree handled these directories like a champ! :)

polarathene avatar May 29 '19 09:05 polarathene

hi, at the moment this is simply a literal string comparison, but it could be extended easily to use globbing or regex.

PRs are welcome for this

nachoparker avatar Sep 23 '19 02:09 nachoparker

The README/help text aren't clear on the --exclude option. How do you exclude multiple?

eg --exclude="filedir_a filedir_b filedir_c"? Delimiting by space and comma seems to have no effect

polarathene avatar Oct 31 '19 08:10 polarathene

You can use -x file1 -x file2

nachoparker avatar Oct 31 '19 22:10 nachoparker

Hello from Aug 2021 :)

I was searching for this functionality again, even just to filter/search by a single file extension at a time. Looking through various tools again for this and this feature remains rare to find, at best it is usually exclude only. So I need to resort to using traditional linux commands like find and awk in a script.

polarathene avatar Aug 09 '21 22:08 polarathene