Find in Files - search only files with no extension
-
I’m trying to do a Find In Files search for some text. I have a series of file extensions that I want to look through, but one of the file extensions is blank. I’ve tried using *. (but it doesn’t catch them) and ext[] and *.ext[] (but they don’t catch them), and even * (but it searches too many files). What is the syntax for this?
-
Afaik, there is no syntax for finding files without extension only available, as PathMatchSpec API function
is used, but the * should have found it - did a quick test (searched COPYING) and found LICENSE file.
What can be used is
? - for a single letter
* - multiple letters
and the dot of course.Maybe you need to construct something like ?????? for README but it would also find a
file like ab.txt.Cheers
Claudia -
“*” did find it - but it also caused it search *.exe and *.dll and other large files that really slows things down. This is for a common search I do often… hopefully someone else will have a good suggestion. Thank you Claudia for taking the time to respond.
-
@John-Bowman If you are willing to use an outside search tool when you need to do searches that NPP can’t, you might do a web search for GrepWrap. I use it from time to time because it allows me to specify what NOT to search (both file and directory names) as well as what to search.
-
Hello, John Bowman and All,
I did some tests and , indeed, there’s no way to perform a search on files without extension, only, in the search in Files dialog !
In the Filters zone, of the Replace in files dialog :
-
The exclamation mark (
?
) represents any single character, included space and dot, which may part of the file name -
The asterisk symbol (
*
) represents any range, even empty , of characters, included spaces* and dots -
The space OR semi-colon (
;
) characters represents the usual separator between two or more filters
So, given the list of files, below :
abcd.txt abcdefgh ab.cd.st at abcd efgh.txt abcd_efgh.h abcd.py
The filters :
- ???????? => The S/R would be performed on the 3 files "abcd.txt", "abcdefgh" and "ab.cd.st" - a*t => The S/R would be performed on the 4 files "abcd.txt", "ab.cd.st", "at" and "abcd efgh.txt" - abcd?efgh* => The S/R would be performed on the 2 files "abcd efgh.txt" and "abcd_efgh.h" - *.txt => The S/R would be performed on the 2 files "abcd.txt" and "abcd efgh.txt" - abcd.* => The S/R would be performed on the 2 files "abcd.txt" and "abcd.py"
Best Regards
guy038
-
-
If you don’t mind the idea of creating some new commands (one-time-only) and executing TWO additional steps (every search), here is a workaround for Notepad++'s current inability to search in extensionless files.
Your workflow will be slightly modified:
Step 1: Run command “Rename *. to *.NOEXT” (defined below) on the Run menu to rename extensionless files to have extension “.NOEXT” (while you are editing any top-level file in the search tree that has a real extension)
Step 2: Run your desired search; add *.NOEXT to list of filespecs to search
Step 3: Run command “Rename *.NOEXT to *.” (defined below) on the Run menu to rename .NOEXT files back to being extensionless (again, while you are editing any top-level file in the search tree that has a real extension)Details of command “Rename *. to *.NOEXT”:
One-time setup:
In Notepad++'s Run menu, choose Run…
Paste the following in “The Program to Run” box:
cmd /c cd $(CURRENT_DIRECTORY) & For /R %G in (*.) do REN "%G" "%~nG.NOEXT"
Press the Save button and name it something meaningful like “Rename *. to *.NOEXT”
After accepting the name via the OK button in the “Shortcut” window, press the Cancel button in the “Run…” window (yes, seems like the wrong thing to do).Details of command “Rename *.NOEXT to *.”:
One-time setup:
In Notepad++'s Run menu, choose Run…
Paste the following in “The Program to Run” box:
cmd /c cd $(CURRENT_DIRECTORY) & For /R %G in (*.NOEXT) do REN "%G" "%~nG."
Press the Save button and name it something meaningful like “Rename *.NOEXT to *.”
After accepting the name via the OK button in the “Shortcut” window, press the Cancel button in the “Run…” window.Thanks to this website for some helpful info on renaming files: http://ss64.com/nt/ren.html