To find files by multiple file extensions I use in Linux smt like this (in terminal):
find ./ -type f \( -iname \*.txt -o -iname \*.json \)
And here result:
./test.txt
./project_1_1/test.json
./project_1_1/test1_1.txt
./project_1_2/test_1.2.txt
Nice. But what about Emacs? Is it possible in Emacs to find files with multiple file extensions and open result in separate buffer? I need this because then I want to delete all find files.
M-!
. – NickD Nov 16 '23 at 22:27find-file
to open them all in emacs? – Maxim Kim Nov 16 '23 at 22:41M-x find-name-dired
be enough? – Manuel Uberti Nov 17 '23 at 07:43-exec
option or the-execdir
option offind
(both with the;
and the+
suffix), you should find out about them. You should also probably become familiar withxargs
. OTOH, if you want to learn some Elisp, @shynur's answer contains a bunch of things that you probably want to learn. But the quickest and safest way to a solution to your problem is to add-execdir rm '{} \+
to yourfind
command. BTW, I would always run the initialfind
command first to make sure that it is picking up only files you want removed. Then run it with-execdir ...
. – NickD Nov 17 '23 at 15:34execdir
option:-execdir rm '{}' \+
. – NickD Nov 17 '23 at 16:45find-dired
with the args you prefer, e.g.,-name \*.json -o -name \*.txt
. – Manuel Uberti Nov 20 '23 at 08:16