Open files that start with (or contain) a pattern
-
Hi
How can I configure Notepad++ to open files that start with a specific pattern?
I have files that are all named starting with “Process_A”
Process_A.e1234
Process_A.o1234
Process_A.e4567and so on
Is there a way I can configure the “File Association” field to:
[1] open files that start with a specific pattern (files starting with Process_A as outlined above)
[2] open files that end with “.e\d+” (using perl like syntax here - i.e. files that end with dot followed by the letter e followed by a number")
Thanks in advance,
Anand -
Hmmm…not really a Notepad++ question per se, so I won’t get too deep into it…but you could do something like this at a CMD prompt (or batch file):
For [1]:
for %f in (Process_A*) do echo %fFor [2]:
for %f in (*.e????) do echo %fwhere of course you replace
echowith a command-line to invoke Notepad++…This hopefully will get you started on a solution…the solution for #2 isn’t real “tight”… :-)
-
If you’re going to invoke perl for me… :-)
>ls -latr total 132 -rw-rw-rw- 1 Peter.Jones 0 0 2018-10-31 08:08 Process_A.e1234 -rw-rw-rw- 1 Peter.Jones 0 0 2018-10-31 08:08 Process_A.o1234 -rw-rw-rw- 1 Peter.Jones 0 0 2018-10-31 08:08 Process_A.e4567 -rw-rw-rw- 1 Peter.Jones 0 0 2018-10-31 08:09 pre.e1 -rw-rw-rw- 1 Peter.Jones 0 0 2018-10-31 08:09 pre.e12 -rw-rw-rw- 1 Peter.Jones 0 0 2018-10-31 08:09 pre.e123 -rw-rw-rw- 1 Peter.Jones 0 0 2018-10-31 08:09 pre.e1234 drw-rw-rw- 2 Peter.Jones 0 4096 2018-10-31 08:09 . drw-rw-rw- 27 Peter.Jones 0 131072 2018-10-31 08:23 .. >perl -e "for(glob('Process_A*')){ system(qq(echo path/to/notepad++.exe $_)) }" path/to/notepad++.exe Process_A.e1234 path/to/notepad++.exe Process_A.e4567 path/to/notepad++.exe Process_A.o1234 >perl -e "for(glob('*.*')){ next unless /\.e\d+/; system(qq(echo path/to/notepad++.exe $_)) }" path/to/notepad++.exe pre.e1 path/to/notepad++.exe pre.e12 path/to/notepad++.exe pre.e123 path/to/notepad++.exe pre.e1234 path/to/notepad++.exe Process_A.e1234 path/to/notepad++.exe Process_A.e4567All you have to do is remove the echo, and fix
path/to/notepad++.exe, and those perl one-liners will do what you want. :-) -
Thanks Peter and Scott for the responses.
In my case, I am “not” specifically looking to open all files at once.
I just want to be able to configure Npp File association to be able to open files that start with a specific pattern (or contain a pattern).
-
Windows file associations don’t work on patterns, they work on fixed extensions.
Personally, I have a notepad++ association on the (windows-special)
*HKCR entry (though not the default assocation, of course), so I can right click and “Open with notepad++” no matter the extension.update: added “windows-special” above. In the registry’s HKCR, that
*entry is not really doing a file globbing; it’s the windows registry notation for “all file types”. -
I REALLY CANT ANSWER THAT ONE BUT I CAN TELL U THIS
-
@PeterJones said:
… I can…“Open with notepad++” no matter the extension.
Amen–it’s what I do as well. I’ve never really understood file extension association with something like Notepad++, so I don’t understand what all the usual hullabaloo is about (all the questions on this Community concerning it). Sure, I understand file associations for something like .xlsx where it is ALWAYS going to be Excel that opens those files…but Notepad++ has no such equivalent.
.txtcomes closest I guess, but still…
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login