Auto Backup and Recovery not working
-
For years all open files used to be fully recovered and opened automatically after Notepad++ had been closed, e.g. for a Windows update.
Several months ago this stopped working. After a Windows update or a system crash, files that I had not saved manually are no longer recovered.
Notepad++ usually opens with a blank new note, and the File History does not even list the correct files that were open before the forced closing.
-
Under >Settings>Backup, all of the following are activated:
- Remember current session for next launch
- Enable session snapshot and periodic backup
- Backup every 5 seconds
-
@marco-pk
Well the very first thing you need to do is provide the “debug info” from your ? menu item, then debug info in the drop down. Copy and paste that here.Terry
-
@terry-r Thank you. Here it is.
Notepad++ v8.1.9.2 (64-bit)
Build time : Nov 21 2021 - 04:30:20
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 10 Home (64-bit)
OS Version : 2009
OS Build : 19043.1348
Current ANSI codepage : 1252
Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll -
@marco-pk said in Auto Backup and Recovery not working:
Notepad++ usually opens with a blank new note, and the File History does not even list the correct files that were open before the forced closing.
Your setup seems OK, I think the primary issue was you had a forced closure initiated by Windows/System crash. I don’t know if you’ve ever read the online manual in regards what the backup settings you have actually do, nor possibly the recent FAQ post in this forum on the backup regime. I would strongly urge you to do so, I’ve linked some relevant posts below.
FAQ post is here
Online Manual Reference for backup is also referenced in the previous link
A post where a similar issue to you occurred is here
A post where an irate poster may have got their wish, the developer changed the default settings is hereIt might be almost impossible to recover the files you lost, but a likely location to check is %AppData%. This is entered into File Explorer, it’s a hidden folder.
A common reply to all these posts and others is that you have the responsibility to ensure the backup system you use is correct for your needs. In most of these posts the poster has admitted to never understanding or even reading about the backup options and whilst we have sympathy we can only reiterate the above information.
As I re-read your first post I get the feeling that you never actually saved those tabs, so they were never “real files”, instead just left as temporary holders of text. The session backup option will happily restore these temporary files each time you start Notepad++, however they are not designed to be your saviour in all instances of failure. If a tab’s contents is important then you need to save so that a “real file” is created and then save often.
Terry
-
@terry-r Thank you Terry. I found the missing backups and I installed the Auto Save plugin to get something closer to what I want.
I still don’t completely understand why Notepad++'s behavior changed recently (unsaved files are no longer recovered reliably). It might be that I had actually used the Auto Save plugin before and for some reason, it was uninstalled recently.
-
@marco-pk said in Auto Backup and Recovery not working:
I still don’t completely understand why Notepad++'s behavior changed recently (unsaved files are no longer recovered reliably).
Is it that you installed a new version rather than upgrading a previous version? As I noted in my previous post the defaults have changed for backups due to negative reactions from 1 poster.
Upgrading will keep your previous settings, a new installation will result in the defaults that are installed with that version.
The main thing is at least you have managed to recover some/all your files and now being a bit wiser you have taken the necessary steps to safeguard against potentially losing more files.
Cheers
Terry -
@terry-r Yes, It could be that I installed a new version. The problem is fixed now. Thank you Terry!
-
So I find that, for me at least, the session gets wiped in a very specific way:
Windows restarts (usually due to updates, but not always). It pops up the “waiting to close” window because of some other app that needs saving. You return to windows to save-and-close that other app. You then restart windows. N++ has lost its session and, while all of the files are in %appdata%\notepad++\backup, the effort involved in retrieving them is high.
I found this bash single-liner helpful
(cd $APPDATA/Notepad++/backup; sed -n -e ‘1,/mainView activeIndex/p’ …/session.xml; ls -1 | sort -k 2 -n | while read a; do b=$(echo $a | sed -e ‘s/@.*//’); echo ‘<File filename="’$b’" backupFilePath=“‘$APPDATA’\Notepad++\backup’$a’” />'; done ; sed -n -e ‘/mainView>/,$p’ …/session.xml ) >> …/sessionnew.xml; mv …/session.xml …/session_old.xml; mv …/sessionnew.xml …/session.xml
-
Windows restarts (usually due to updates, but not always). It pops up the “waiting to close” window because of some other app that needs saving. You return to windows to save-and-close that other app. You then restart windows. N++ has lost its session
That’s an excellent description of the sequence of events. I see that @pnedev has upvoted your post – and as that user often contributes code fixes based on reported the loss-of-information bugs in the app, that gives me hope that this will be fixed. I have also added a pointer in issue #9850 so that the rest of the development team can see your description.
, the effort involved in retrieving them is high. I found this bash single-liner helpful
For others reading this thread: one might get bash on Windows by using GitBash, or MSYS2, or cygwin, or …
But if you don’t have or want bash, other alternatives exist: for example, my
RecoverLostSession.py
script for PythonScript plugin, or the C# program earlier in that discussion. So we are getting a better suite of tools to attempt to recover the session based on the Notepad++ backup folder, which will hopefully tide us over until the developers can fix the root cause. -
@Geoff-Winkless said in Auto Backup and Recovery not working:
It pops up the “waiting to close” window because of some other app that needs saving.
Good info, but I am still not able to reproduce that with it (and get my session.xml emptied).
I am working on this issue - could you please follow the instruction here?
(then you can post content of your “nppLogNulContentCorruptionIssue.log” file here, if you do not have a GitHub account)