Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How search and list files in Intellij Idea?

There is of cource ctrl+alt+N for file search, but it only for open files. What if it is need to find file by criteria, say which starts from "newFile" and delete them or move to another folder? The key problem that Intellij Idea Search implemented only for file content, not file names. Also with ctrl+alt+N I can not list these files, select some of them and some action. It there something for batch file operation?

like image 325
Cherry Avatar asked Mar 10 '17 08:03

Cherry


2 Answers

I'm using the following way to find a list of files matching a certain criteria:

  • Open "Find in Path" menu Ctrl+Shift+F
  • Enter nothing into the main search box
  • In top-right corner, check the "File mask" option
  • Use a tiny input field to enter your file mask, e.g. newFile* or *.test.js
  • For convenience, you can also press "Open in Find Window" in bottom-right corner, so the IDE would show the search results in a docked toolbox

I agree JetBrains could make this functions more obvious / straightforward to discover and use.

Tested with WebStorm 2018.2.2 and Intellij IDEA 2018.3. Hope that helps someone!

like image 129
Vladimir Salin Avatar answered Sep 22 '22 15:09

Vladimir Salin


You can use the "Search Everywhere" window.

To open the window press the search button in the top right hand corner of IntelliJ, or double-press shift.

Screenshot of the Search Everywhere window in IntelliJ

From here you can enter your search criteria, and it will return all matching files within the current project.

There is a checkbox to include non-project files if you wish. You can also use wildcards, and a forward slash at the start of the search will only find results beginning with the criteria.

For example: Searching for /newFile*.java will find all .java files starting with newFile.

If you omit the forward slash, it will return all .java files with newFile anywhere in the file name.

More information on the Search Everywhere function can be found here.

With regards to completing batch file operations on the list of files found, I do not know of any way that you can do this within IntelliJ. The simplest method would be to manually selecting each file in the Project window whilst holding ctrl, and then right-click and run your desired action on all items selected.

like image 45
Scarfe Avatar answered Sep 23 '22 15:09

Scarfe