Recent autosave for some files but not others
-
Let me preface this by saying that I know I am an idiot.
For a few years now, I have used the Notepad++ Autosave plugin and the “save/open last session” option. I may be using the wrong term, but when I open Notepad++, all my previously open files are there, whether saved or not. Even if my computer reboots. This includes all the unsaved files that I work with, called “new xx”, which I think have been getting backed up by Autosave (though it is possible that they are not and I’ve been relying exclusively on the restore last session feature).
This morning when I opened Notepad++, none of the “new xx” files opened – only files that I had specifically saved and named were present.
I went to the backups folder in Users\AppData\Roaming and found all the autosave files. I celebrated for a moment at my good fortune.
I opened the most recent autosave and it was accurate – something I had written at about 5 pm last night.
The file I was actually interested in was next. I had been working on this file for 2 days and had last edited it at 3:30 pm last night. Since a different file had been autosaved at 5 pm, I assumed this file would have been autosaved also, since it’s edits were even older. The date modified was June 22, 3:28 pm. Perfect.
Except it’s not. The file has none of my edits from the June 22 at all. Maybe not even the edits from June 21. It says it was modified June 22 at 3:28 pm, but the filename says June 20. (see picture). When I open it, it’s a very old version, probably from around June 20.
What’s going wrong here, and is there any way to fix it? The file I care about is called new 974. I would sell my first-born to get my edits to this file.
-
You know that you made a mistake. But to drive home the point: Honestly, if the file is important enough now that are willing to sell your first-born, it should have been important enough on Jun 20 to start saving it into a known location, and to start using one or more backup methods under your control (backup software, saving to a cloud location, using version control software, and/or similar) rather than hoping you understand how the periodic backup function works (which you’ve proven you didn’t understand) and/or how the Autosave Plugin works, and relying on it to work 100% of the time on critical data. My file philosophy is “Save Early, Save Often; Commit Early, Commit Often”. I only leave files in the
new NNN
state for as long as it takes me to decide where in my project folder structure this file will be; anything else is asking for data loss. But I will assume you’ve learned that part of the lesson. Now, on to how it works:I will talk mostly on the builtin features, because until today, I had never even downloaded the Autosave plugin.
With Notepad++'s builtin “save/open last session” + “enable session snapshot and periodic backup”, Notepad++ automatically saves a backup of all edited-but-not-saved files into the defined backup directory, every N seconds (as defined by preference setting – defaults to 7sec). Please note that if you only had the “save/open last session” checked on without the “enable session snapshot and periodic backup” also checked on, then Notepad++ would not be keeping periodic backups of unsaved files at all – so it must be on for you to have the
new NNN@yyyy-mm-dd_hhmmss
files in that backup folder. (The fact that you didn’t mention the relevant setting is one of the reasons I am quite certain you didn’t fully understand how the periodic backup works.)For named files: The name of the backup file is
filename.ext@yyyy-mm-dd_hhmmss
. As soon as you manually save the file (so it’s written to disk in the real location), the backup goes away, because the purpose of the periodic backup is to save a copy of a file that you’ve edited but not saved. The timestamp part of the periodic-backup-name is based on the first automatic save after the last manual save. Example: if you saved a file at 8:10:00am, the backup would go away; then, at 8:12:30am, you type something but don’t save, so sometime within N seconds of that (8:12:30+N) it will periodic-backup-save and make a file with a timestamp about then – something likefilename.ext@2021-06-23_081234
. If you left for a while (or exited Notepad++ and reloaded) and came back at 12:34:56pm and typed another character, it would do it’s periodic-backup-save on that file again so the last-modified time of the backup would be updated), but the name of the periodic-backup file will remain the same.For unnamed files: the name of the backup file is
new NNN@yyyy-mm-dd_hhmmss
. Sincenew NNN
files are by definition not manually saved, the timestamp in the periodic-backup filename is based on when it did the first periodic-backup-save for that unnamed file.So, in your scenario above, your filename is
new 974@2021-06-20_210144
, with a date-modified of 6/22/2021 3:28pm, that means that the first periodic-backup-save fornew 974
was done on Jun 20 at 9:01:44pm, and the most recent periodic-backup-save was on Jun 22 at 3:28pm. If you are 100% certain that you had made changes in that exact unnamed file between Jun 20 and Jun 22 that didn’t show up in the Jun 22 3:28pm periodic-backup-save (and you are sure it wasn’t accidentally in a different one of your nearly-1000 unnamed files that you’ve made over the last months or years), then something strange happened. But we can never really be sure. But if the changes really were before Jun 22 at 3:28pm, then my guess is that at 3:28pm, you accidentally hit UNDO so it went back to the previous state, then did it’s periodic-backup-save, recording the 3:28pm state of the file to the defined backup folder for the periodic-backup files.Based on that scenario, assuming that you were making multiple changes from Jun 20 9:01pm and Jun 22 3:28pm, Notepad++ presumably wrote that file multiple times between there as you were making the edits. If so, file recovery software like Recuva might (or might not) be able to recover one of the earlier copies of the file from that folder. But I make no guarantees that you can get it back. Good luck on that.
Now a brief foray into AutoSave plugin. I’ve never used it before. But when I first installed it, out of the box it seems to be doing nothing. Looking at the default settings dialog for the plugin:
It looks like the AutoSave is not turned on for Notepad++ losing focus, and not turned on for timed intervals of N minutes. Based on those options, if you were to turn it on for one or both of those, then for named files, you have the choice of not auto-saving, of overwriting the named file in the named file’s directory, or of saving a second auto-recover file in the same place. For experiments, I told it to go on losing focus and every 1 minute(s). When I tabbed back to my browser with unsaved changes in namedfile.txt, I see that it saved namedfile.txt (and that Notepad++'s periodic backup file went away, because Notepad++ interprets the AutoSave actions as a “manual” save, so there are no longer unsaved changes in that file, from Notepad++'s perspective). I changed the AutoSave option to “save autorecover in same directory”, made changes to the file, then changed focus to my browser: the plugin creatednamedfile.txt~
in the same directory asnamedfile.txt
(but this time, since the state of the main file in Notepad++ is still “unsaved changes”, the Notepad++ periodic-backup for the namedfile still exists).Looking at the AutoSave plugin options for unnamed files: it seems to default to doing nothing with those files. But it appears it can either prompt you for a filename, or save to a specific directory, or save autorecover to a specific directory.
But for AutoSave to do anything, you have to manually configure it the way you want. Since you didn’t mention any of the AutoSave settings when you described your problem, that tells me you probably didn’t know that you had to choose your own settings, so you’ve probably been working out of the box without actually using any of the AutoSave plugin capabilities, and it’s thus been doing you no good. (I’d like to be wrong, and you just didn’t think of telling us what settings you’ve used.)
At this point, I highly recommend you spend some time experimenting with how exactly Notepad++'s periodic backup works, and how the AutoSave plugin works, so that you can be sure that you know how they work, and that they’re set up in a way that will actually help you. And please understand that no automatic-save-of-unnamed files is 100% effective, and that you are responsible for saving your files to a known location and making sure you have good working copies and good backups of any critical or mildly important data (and especially for any files that are worth more than your first-born).
-
Perhaps the non-autosave portion of your posting could be adapted for the user manual (if not already covered in such depth there). Some good information in your posting.