I had my Notepad++ with at least 50 opened files on it, organizing all my work.

I left the computer as always hibernating overnight and surprise, this morning all was gone.

An error message popped up when maximizing Notepad++, something along a file not being able to be opened.

I accepted the error and Notepad++ had no files on it.

After rebooting nothing changed, and in the backups folder I only found standalone old dirty files that I worked on a long time ago...

Any thoughts on how to recover my precious working session?


  • I searched for the session.xml file on C:\Users\user.user-PC\AppData\Roaming\Notepad++ but it got "reset" and isn't showing all the old opened tabs. I went to [right click] > Preferences > Old Versions but there's no old version available. On Windows Temp folder there're no "session" files, on "n++" or "npp" or "notepad" files :(
    – Peanuts
    Jul 27 '18 at 16:41
  • Possible duplicate of Is there any way to recover unsaved notepad++ docs? Aug 21 '18 at 13:02

You cannot, but you can secure against happening this again.

This is possible if you have your cloud path set in Preferences:

enter image description here

After the breakdown, immediately turn off syncing with the cloud and restore the original file from there. If your cloud has file versioning, then it is simpler: just retrieve the older version of the sessions.xml.

This also works for all other setting files, see the link above for details.

Also be sure that you updated to at least Notepad++ 7.5.9.

In its list of fixed bugs, there is

  1. Fix possible file corruption during backup or power loss or other abnormal N++ termination.

So yes, this has been addressed in October 2018.

  • 5
    I have Notepad++ 7.5.9 and this just happened to me: my computer lost power (UPS failed!) and when I opened Notepad++ again I see a clean session. In the "backup" folder I see copies of the unnamed files, but I see no way to restore all the named files I was working on
    – Joe Pineda
    Nov 22 '18 at 16:18
  • @JoePineda – hm, thanks for sharing. So maybe the cloud backup is really the next option to try? Even if the backup may be delayed, it can be still better to recover somewhat older tab set then start with blank one.
    – miroxlav
    Nov 23 '18 at 9:00
  • 2
    @miroxlav I ended up installing "recuva" as suggested in another answer to the same data loss by Notepad++ - it worked like a charm, recovering all the files I was working at the moment, and even the session file (which I manually substituted). I only needed to point recuva to a shared folder on another network machine to leave the files at. I was dissappointed by Notepad++, though, this destroying of user info is totally unacceptable - they should be using SQLite or something like that to have ACID changes in the files they're touching, database-style
    – Joe Pineda
    Nov 26 '18 at 23:46
  • 1
    (Here is one example of an answer describing what Joe mentions regarding using Recuva... the first time I tried it, I didn't think it had worked, but lo and behold I tried again and made sure to recover the file the way this answer mentions, and it worked!) Oct 2 '20 at 7:11

Unless you have saved your session in the cloud, like the previous answer, you can't restore your whole session. You can, however, restore your unsaved (new) notes. They are stored at:


You may either open all those files directly in Notepad++, or you can remake the session file in:


so that the <mainView> section will include all of them.

Here's a Python script to make it easier to redo the session file. Just paste the output between the <mainView> and the </mainView> tags:

import os
import os.path as osp

npp_path = osp.join(osp.expandvars('%APPDATA%'), 'Notepad++', 'backup')
for fn in sorted(os.listdir(npp_path), key=lambda fn: fn.split('@')[1]):
    name = fn.split('@')[0]
    print('<File firstVisibleLine="0" xOffset="0" scrollWidth="64" '
          'startPos="8" endPos="8" selMode="0" lang="Normal Text" '
          'encoding="-1" userReadOnly="no" filename="{name}" '
          'backupFilePath="{npp_path}\{fn}" originalFileLastModifTimestamp="0"'
          'originalFileLastModifTimestampHigh="0" '
          'mapFirstVisibleDisplayLine="-1" mapFirstVisibleDocLine="-1" '
          'mapLastVisibleDocLine="-1" mapNbLine="-1" mapHigherPos="-1" '
          'mapWidth="-1" mapHeight="-1" mapKByteInDoc="0" '
          'mapWrapIndentMode="-1" mapIsWrap="no" />'.format(
                  name=name, npp_path=npp_path, fn=fn))
  • 1
    This is no longer enabled by default: Settings -> Preferences -> Backup and ensure 'Enable session snapshot and periodic backup' is checked Apr 1 '20 at 18:47
  • Yes, the backups were in the user/<name>/appdata/backups folder, and I could simply recover them. The backups seem to be disabled now - so that is a gotcha.
    – amelvin
    Jul 27 '20 at 10:30
  • although I got too many duplicate new N files with empty content (probably because they were there in the backup folder with 0 bytes) but this script really helped me to recreate the session.xml. Thanks. Jul 9 at 11:35

Thanks to Joe Pineda for his comment on the backup folder. After losing my crashed session, I saw that in this folder there were many files - both unsaved notes and opened existing files. They were of non-zero size in bytes but neither the ordinary Notepad, nor Notepad++ itself displayed anything. However, you can read them in Linux.

Remember to make a copy of your backup directory in case something unexpectedly goes wrong.

I recovered my unsaved notes by making a list of the file names and removing the "new" from the filename (Windows just loves spaces in file names).

for note in $(ls new*); do echo $note | grep -v new; done

This list of names can be saved in a variable and then the files can be copied to e.g .txt:

filenames=$(for note in $(ls new*); do echo $note | grep -v new; done) 
for f in $filenames ; do cp 'new '$f 'new '$f.txt; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.