Community
    • Login

    Where are new files (still unsaved by the user) stored?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    11 Posts 4 Posters 373 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.
    • CletosC
      Cletos
      last edited by

      I open a new file, automatically named “new 1” and write in it. When I close Notepad++ then and open it that file is available with all the text. Where are these files not being saved by the user stored?

      When I open Notepad++ and an external drive X: is not connected that file is not opened. And it will not be opened after connecting that drive. How could I open “new 1” though? Or find it on the hard disk?

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Cletos
        last edited by

        @Cletos said in Where are new files (still unsaved by the user) stored?:

        Where are these files not being saved by the user stored?

        Look in the “backup” directory as specified in the Preference settings. It is shown there (but you can’t change it).

        @Cletos said in Where are new files (still unsaved by the user) stored?:

        When I open Notepad++ and an external drive X: is not connected that file is not opened. And it will not be opened after connecting that drive.

        I think this is a different question but it is rather muddled. If a file in the default session can’t be found when Notepad++ starts, you should get a prompt about this.

        1 Reply Last reply Reply Quote 1
        • CletosC
          Cletos
          last edited by

          Thank you very much!

          Mhm.
          @Alan-Kilborn said in Where are new files (still unsaved by the user) stored?:

          I think this is a different question

          Yes yes, that’s absolutely right. I would have thought—why ask the same question twice in the same post? But maybe it gets more understandable then.

          but it is rather muddled. If a file in the default session can’t be found when Notepad++ starts, you should get a prompt about this.

          Ah, sorry, thank God it obviously wasn’t to muddled for you. But maybe there’s some more muddling because of the missing context now. There was no prompt, if I remember correctly. What I meant was:

          When I open Notepad++ and an external drive X: is not connected that file is not opened. And it will not be opened (any more) after connecting that drive (and after restarting Notepad++ then). How could I open “new 1” though? Or find it on the hard disk? I’m afraid the file might be removed when Notepad++ reopens, since it couldn’t be found after the drive was disconnected. Is that correct? Apparently, this also happens with backups of unsaved files (e.g., ‘new 1’) when the unsaved originals are discarded in Notepad++.

          mkupperM 1 Reply Last reply Reply Quote 1
          • mkupperM
            mkupper @Cletos
            last edited by

            @Cletos said in Where are new files (still unsaved by the user) stored?:

            When I open Notepad++ and an external drive X: is not connected that file is not opened. And it will not be opened (any more) after connecting that drive (and after restarting Notepad++ then). How could I open “new 1” though? Or find it on the hard disk? I’m afraid the file might be removed when Notepad++ reopens, since it couldn’t be found after the drive was disconnected. Is that correct? Apparently, this also happens with backups of unsaved files (e.g., ‘new 1’) when the unsaved originals are discarded in Notepad++.

            Notepad++ maintains a list of the open tabs or files. The list is stored in your session.xml file. This is how Notepad++ remembers the new 1 style files. The existence of your new 1 files is remembered in the session.xml file. The contents of each new 1 file are saved in Notepad++'s backup folder.

            The new 1 style files are special in that there is no file path for them. The actual file names and file paths to them are hidden within Notepad++. You can see this for yourself by right clicking on the tab for a normal file and selecting Copy to Clipboard / Copy Full File Path. If you paste that somewhere you will see the full path to your file. When you use Copy to Clipboard / Copy Full File Path on a new 1 style file it put just the name, new 1, in the copy/paste buffer and not a full file path.

            You need to inspect your session.xml file to get the actual file path and file name for the new 1 file. The actual file path and name will be something like C:\Users\%USERNAME%\AppData\Roaming\Notepad++\backup\new 1@2025-04-03_093326 where %USERNAME% is your Windows login name and the 2025-04-03_093326 part is the date/time the file was created and is formatted as YYYY-MM-DD_HHMMSS.

            There is also one other technical “gotcha” in that when you first create a new 1 tab that it’s blank or empty and there is no file in Notepad++'s backup folder for it. The instant you put anything in that file, even if it’s to just tap the Enter key once to add a blank line then Notepad++ silently creates a new 1@2025-04-03_093326 style file in backup folder and will start saving the contents of the new 1 to that file.

            When you start Notepad++ it loads the session.xml file to repopulate the tabs. If a file is no longer accessible then Notepad++ silently removes mention of the file from session.xml. Notepad++ used to pop up a warning message that the file was no longer accessible. I have forgotten why this change made sense to people at the time. It means though that if drive X: is not on line at the time you start Notepad++ that the editor will silently remove all of the tabs for files on drive X: when it’s started.

            PeterJonesP 2 Replies Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @mkupper
              last edited by PeterJones

              @mkupper said in Where are new files (still unsaved by the user) stored?:

              If a file is no longer accessible then Notepad++ silently removes mention of the file from session.xml. Notepad++ used to pop up a warning message that the file was no longer accessible. I have forgotten why this change made sense to people at the time.

              Unfortunately, you’ve apparently forgotten more than that.

              that the editor will silently remove all of the tabs for files on drive X: when it’s started.

              Not silently. It prompts you, and gives you a workaround: if you choose Yes, it will create placeholders, in which case you will see empty placeholder tabs in Notepad++, which will automagically re-populate with the contents of the remote file if the drive returns. Or, if you choose No, then it will internally “close” those files and stop looking for them from then on.

              Test sequence @ cmd.exe and Notepad++ v8.7.5 (but any recent version (since v8.6) behaves the same):

              • c:> echo FileContents > FileToDelete.txt
              • c:> "c:\program files\Notepad++\notepad++.exe" FileToDelete.txt
              • Notepad++ Settings > Preferences > Backup, ensure ☐ Remember inaccessible files from past session is checkmarked [added this step, see my reply below]
              • Exit Notepad++, making sure session is saved, so FileToDelete.txt will try to be open next run.
              • c:> del FileToDelete.txt
              • c:> "c:\program files\Notepad++\notepad++.exe"
              • Notepad++ prompts you:
                c1844a9f-b30b-4a78-a75c-a4cb1a068c5f-image.png
              • Choose Yes
              • Notepad++ shows an empty (locked) tab:
                32b4b3bf-82bd-4eae-a9a6-2e848bc22798-image.png
              • c:> echo NewFileContents > FileToDelete.txt
              • When you switch back into Notepad++'s FileToDelete.txt tab:
                abdb6c3c-245a-479f-acc5-46a7152962a4-image.png
              • Say Yes, and you get the new file contents, and Notepad++ unlocks.
                f0b20501-260c-466a-8cfd-27975ef56dac-image.png
              1 Reply Last reply Reply Quote 4
              • PeterJonesP
                PeterJones @mkupper
                last edited by PeterJones

                @mkupper ,

                Update: It’s here in the User Manual, and that reminded me there’s a Settings > Preferences > Backup setting ☐Remember inaccessible files from past session which toggles that behavior.

                I had forgotten there was the setting, and opening a recent portable unzip, I see that feature is off by default, which probably explains why it doesn’t do that for you. Edited the above answer to show people to confirm that setting.

                @Cletos ,
                Recommendation: If you have network files that sometimes disappear, turn on this setting.

                1 Reply Last reply Reply Quote 4
                • CletosC
                  Cletos
                  last edited by

                  Thank you very much, mkupper!

                  You need to inspect your session.xml file to get the actual file path and file name for the new 1 file. The actual file path and name will be something like C:\Users%USERNAME%\AppData\Roaming\Notepad++\backup\new 1@2025-04-03_093326 where %USERNAME% is your Windows login name and the 2025-04-03_093326 part is the date/time the file was created and is formatted as YYYY-MM-DD_HHMMSS.

                  I guess, the problem is, after restarting Notepad++ (without access to the disconnected drive) that session file will be changed / replaced, so that the older files there are no longer available (if I only had a back up of it). Or am I missing anything?

                  There is also one other technical “gotcha” in that when you first create a new 1 tab that it’s blank or empty and there is no file in Notepad++'s backup folder for it. The instant you put anything in that file, even if it’s to just tap the Enter key once to add a blank line then Notepad++ silently creates a new 1@2025-04-03_093326 style file in backup folder and will start saving the contents of the new 1 to that file.

                  Yes, I noticed that behavior. But I am afraid, the back up will be automatically deleted when that new 1 file is not available anymore in Notepad (e.g. after restart without connected drive).

                  When you start Notepad++ it loads the session.xml file to repopulate the tabs. If a file is no longer accessible then Notepad++ silently removes mention of the file from session.xml.

                  Yes, that’s the issue here. And it does not keep session file unchanged to the next start (when the drive is connected again). So these informations are lost.

                  It means though that if drive X: is not on line at the time you start Notepad++ that the editor will silently remove all of the tabs for files on drive X: when it’s started.

                  Yes, if it would keep the old information, everything would be good.

                  Not silently. It prompts you, and gives you a workaround: if you choose Yes, it will create placeholders, in which case you will see empty placeholder tabs in Notepad++, which will automagically re-populate with the contents of the remote file if the drive returns. Or, if you choose No, then it will internally “close” those files and stop looking for them from then on.

                  So one message will appear for ALL the files not available at the moment? Or one for every file not available?

                  Say Yes, and you get the new file contents, and Notepad++ unlocks.

                  Ah yes, I seem to remember that. It confused me—I thought it was a bug, misinformation or a malfunction or so, since no other program should’ve / could have modified those .txt files respectively files without extension.

                  Recommendation: If you have network files that sometimes disappear, turn on this setting.
                  Many thanks! Yes, just enabled it.

                  PeterJonesP 1 Reply Last reply Reply Quote 0
                  • PeterJonesP
                    PeterJones @Cletos
                    last edited by

                    @Cletos said in Where are new files (still unsaved by the user) stored?:

                    Thank you very much, mkupper!

                    You need to inspect your session.xml file to get the actual file path and file name for the new 1 file. The actual file path and name will be something like C:\Users%USERNAME%\AppData\Roaming\Notepad++\backup\new 1@2025-04-03_093326 where %USERNAME% is your Windows login name and the 2025-04-03_093326 part is the date/time the file was created and is formatted as YYYY-MM-DD_HHMMSS.

                    I guess, the problem is, after restarting Notepad++ (without access to the disconnected drive) that session file will be changed / replaced, so that the older files there are no longer available (if I only had a back up of it). Or am I missing anything?

                    @Cletos , I think you misunderstood @mkupper. The section about the new 1 files and the backup directory have nothing to do with your X: drive. They are two completely unrelated concepts. Stop mixing them together.

                    There is also one other technical “gotcha” in that when you first create a new 1 tab that it’s blank or empty and there is no file in Notepad++'s backup folder for it. The instant you put anything in that file, even if it’s to just tap the Enter key once to add a blank line then Notepad++ silently creates a new 1@2025-04-03_093326 style file in backup folder and will start saving the contents of the new 1 to that file.

                    Yes, I noticed that behavior. But I am afraid, the back up will be automatically deleted when that new 1 file is not available anymore in Notepad (e.g. after restart without connected drive).

                    again, new 1 behavior has NOTHING to do with the X: drive. new 1 files don’t go on the X:-drive, so whether or not Notepad++ can see the X: drive does not affect the new 1 behavior in any way, shape, or form.

                    Yes, that’s the issue here. And it does not keep session file unchanged to the next start (when the drive is connected again). So these informations are lost.

                    When the new setting was added to Notepad++, we encouraged the author to turn it on by default. But he didn’t. So you have to turn it on to get the X:-drive behavior that you want.

                    Yes, if it would keep the old information, everything would be good.

                    It does, if you turn on the option.

                    So one message will appear for ALL the files not available at the moment? Or one for every file not available?

                    One single message for all files, no matter how many files it was. Hence, the screenshot from the actual occurrence showing the word “files” (plural).

                    Say Yes, and you get the new file contents, and Notepad++ unlocks.

                    Ah yes, I seem to remember that. It confused me—I thought it was a bug, misinformation or a malfunction or so, since no other program should’ve / could have modified those .txt files respectively files without extension.

                    I am sorry it confused you.

                    Recommendation: If you have network files that sometimes disappear, turn on this setting.

                    Many thanks! Yes, just enabled it.

                    Also, make sure you say *Yes to both the “File inaccessible” dialog, and whenever you’ve done that, also say Yes if Notepad++ asks if you want to “reload” the placeholder file.

                    CletosC 1 Reply Last reply Reply Quote 2
                    • CletosC
                      Cletos @PeterJones
                      last edited by

                      @Cletos , I think you misunderstood @mkupper. The section about the new 1 files and the backup directory have nothing to do with your X: drive.

                      again, new 1 behavior has NOTHING to do with the X: drive. new 1 files don’t go on the X:-drive, so whether or not Notepad++ can see the X: drive does not affect the new 1 behavior in any way, shape, or form.

                      Although it looks like that in this case: when I close a new 1 file without saving it its back up file immediately will automatically be deleted. So maybe the same happens here: the back up of new 1 will be automatically deleted when that new 1 file is not available anymore in Notepad (e.g. after its restart without connected drive), so the back up of new 1 will be deleted. I do not have new 1 files in the backup folder not being open in Notepad anymore. There are only new 1 files open in Notepad.

                      So maybe the back up will not automatically be deleted when that new 1 file is not available anymore in Notepad (e.g. after restart without connected drive)? So its content is lost.

                       Yes, if it would keep the old information, everything would be good.

                      It does, if you turn on the option.

                      Yes yes, but unfortunately its too late for the lost back ups of new 1 files.

                      I am sorry it confused you.

                      No no, no reason to say sorry at all. But one might think, if these informations seem to be totally senseless others might be as well, respectively unreliable. For example this one (“files” (plural)):

                      Hence, the screenshot from the actual occurrence showing the word “files” (plural).

                      Also, make sure you say *Yes to both the “File inaccessible” dialog, and whenever you’ve done that, also say Yes if Notepad++ asks if you want to “reload” the placeholder file.

                      OK, I will do so, thank you very much!

                      PeterJonesP 1 Reply Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones @Cletos
                        last edited by

                        @Cletos said in Where are new files (still unsaved by the user) stored?:

                        Although it looks like that in this case: when I close a new 1 file without saving it its back up file immediately will automatically be deleted. So maybe the same happens here: the back up of new 1 will be automatically deleted when that new 1 file is not available anymore in Notepad (e.g. after its restart without connected drive), so the back up of new 1 will be deleted.

                        If you have Session Snapshot enabled, it will remember the contents of your new 1 even after restarting Notepad++ or even rebooting Windows. Please show a screenshot of your Settings > Preferences > Backup and share your ?-menu’s Debug Info, because the words you are typing contradict everything I’ve seen after years of using Notepad++.

                        Again, I reiterate: new 1 being preserved has nothing to do with the X: drive (unless you have someone set up Notepad++ to use the X: drive for its preferences and backup folder).

                        1 Reply Last reply Reply Quote 0
                        • CletosC
                          Cletos
                          last edited by

                          @PeterJones said in Where are new files (still unsaved by the user) stored?:

                          If you have Session Snapshot enabled

                          These settings I have:
                          alt text
                          https://i.imgur.com/yxx1Fhy.png

                          Again, I reiterate: new 1 being preserved has nothing to do with the X: drive (unless you have someone set up Notepad++ to use the X: drive for its preferences and backup folder).

                          Yes, I had understand. But I reiterate as well: if the back up file (without extension, with date, time being added) of new 1 is deleted when it is no longer available (e.g. when I close it in Notepad) and the same happens when new 1 is not available anymore because of the disconnected X: then, I would think, X: (indirectely) has to do with it (it is one cause (of maybe more / many for the issue) . Is probably a matter of interpretation, I guess, I understand what you mean. With the (new) setting on the screenshot it won’t happen again hopefully.

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