Community
    • Login

    Open files that start with (or contain) a pattern

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 4 Posters 2.2k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • tamuanandT Offline
      tamuanand
      last edited by

      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.e4567

      and 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

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Scott SumnerS Offline
        Scott Sumner @tamuanand
        last edited by Scott Sumner

        @tamuanand

        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 %f

        For [2]:

        for %f in (*.e????) do echo %f

        where of course you replace echo with a command-line to invoke Notepad++…

        This hopefully will get you started on a solution…the solution for #2 isn’t real “tight”… :-)

        1 Reply Last reply Reply Quote 1
        • PeterJonesP Offline
          PeterJones
          last edited by

          @tamuanand ,

          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.e4567
          

          All you have to do is remove the echo, and fix path/to/notepad++.exe, and those perl one-liners will do what you want. :-)

          1 Reply Last reply Reply Quote 0
          • tamuanandT Offline
            tamuanand
            last edited by

            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).

            1 Reply Last reply Reply Quote 1
            • PeterJonesP Offline
              PeterJones
              last edited by PeterJones

              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”.

              Scott SumnerS 1 Reply Last reply Reply Quote 1
              • Donisha JonesD Offline
                Donisha Jones
                last edited by

                I REALLY CANT ANSWER THAT ONE BUT I CAN TELL U THIS

                1 Reply Last reply Reply Quote -2
                • Scott SumnerS Offline
                  Scott Sumner @PeterJones
                  last edited by Scott Sumner

                  @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. .txt comes closest I guess, but still…

                  1 Reply Last reply Reply Quote 2

                  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
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors