Community
    • Login

    Multiple File Search & Replace?

    Scheduled Pinned Locked Moved General Discussion
    8 Posts 5 Posters 4.6k Views
    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.
    • George FisherG
      George Fisher
      last edited by

      Is it possible to search and replace the same text in multiple files at once?

      1 Reply Last reply Reply Quote 0
      • andrecool-68A
        andrecool-68
        last edited by

        There is an option in the search …search in files
        Specify the search directory …and act!

        1 Reply Last reply Reply Quote 4
        • Alan KilbornA
          Alan Kilborn
          last edited by

          Maybe not a bad opportunity to caution users that there is no undo’ing this operation (Replace in Files) for files that are not currently open with Notepad++!

          1 Reply Last reply Reply Quote 5
          • Terry RT
            Terry R
            last edited by

            @George-Fisher said:

            multiple files at once

            There’s also the option within the ‘Replace’ function to perform the replacement on “All Opened Documents”. So open all the files within Notepad++ (assuming not too many that it exceeds available memory, otherwise do in groups).

            In this case I would assume the backup options would be in effect so it bypasses the issue Alan mentioned.

            Terry

            Alan KilbornA 1 Reply Last reply Reply Quote 5
            • Alan KilbornA
              Alan Kilborn @Terry R
              last edited by

              @Terry-R said:

              In this case I would assume the backup options would be in effect

              Well…backups would have to be turned on, but yes I guess they provide some protection from an “oopsy”. But if you use that type of replacement (found on the Replace tab, not the Find in Files tab), then “Undo” will be available (although it is not a “global” undo–you have to physically go to each tab and execute the undo command–which could be a burden if you have a lot of tabs open and affected by the operation).

              It is best to really think about these powerful replace operations BEFORE pressing the button, but I realize sometimes mistakes happen. At least the Replace In Files button makes you confirm it (basically you have to do 2 stupid things instead of just one to screw up). :)

              1 Reply Last reply Reply Quote 2
              • Terry RT
                Terry R
                last edited by

                @Alan-Kilborn said:

                Well…backups would have to be turned on

                Agreed. Actually the other statement you make is true in ALL cases where a regex is used.
                “…think about these powerful replace operations BEFORE pressing the button…”

                As we are (often) using regex to work on large amounts of data it is extremely important to know what the regex is doing to the data, and if an ooops happens then a method for backing out is equally as important. So whether it’s the built-in backup feature of NPP (turned on of course) or a complete copy of the original files set aside, it all falls on the operator to identify a “plan” before hitting THAT button!

                Terry

                1 Reply Last reply Reply Quote 4
                • George FisherG
                  George Fisher
                  last edited by George Fisher

                  I appreciate all the input. My usage of the program isn’t all that critical in the grand scheme of things and I’m not looking at massive files. I like to make mods for a game and sometimes need to change a dozen or so files with the same info. By going into each file and making the change I just felt there must be a better way. lol
                  Again, thank you all! ;)

                  1 Reply Last reply Reply Quote 1
                  • D
                    David-Range
                    last edited by

                    Wonderful! This was simple way to update AdventureWorks2016 to 2022 for all the tutorials I am using. I have used Notepad++ for many years since a colleague showed me.

                    1 Reply Last reply Reply Quote -1
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors