I had a file with no extension, and another file with the same name, but a .json extension. It wouldn’t let me save the file with no extension. At one point I exited Notepad++, and it didn’t ask if I wanted to save. When I opened Notepad++ again, it opened up the file with my edits. But when I did Save A Copy, the edits disappeared.
Two separate issues.
It wouldn’t let me save the file with no extension.
Notepad++ will let you name a file anything, even with no extension. The Windows settings for whether or not extensions are visible may affect what you see in the File > Save (As) and File > Open dialogs, but it will allow an extension; the Notepad++ tab names will correctly show extensions, even when Windows hides that critical information.
If you have set **Settings > Preferences > Default Directory > ☐ Use new style dialog… ** to disabled (so it uses the old-style dialog), the windows-old-standard dialog will apply whatever extension is selected in the dropdown menu to the file. Enable that option, so it uses the modern Windows save-dialog, which will not enforce any extensions based on the drop-down; or name the file
blah.(with a period at the end) which will convince Windows that you are certain you don’t want an extension. But really, just use the new style dialog, and don’t try to travel back in time 5+ years to MS old, annoying, deprecated, dialog style.
it didn’t ask if I wanted to save. When I opened Notepad++ again, it opened up the file with my edits.
Sounds like you have Settings > Preferences > Backup > Enable session snapshot and periodic backup, which allows you to exit without saving changes. Under normal circumstances, this allows you to exit without explicitly saving changes, Notepad++ will save to its backup directory (which it shows in the backup preferences), and as long as Windows didn’t interrupt the save or put it in a io-flush-queue that gets interrupted by an application or OS crash, the next time you open the file Notepad++ will see that periodic backup, and will open the contents of that file, still claiming to be editing the real file. Once you hit File > Save, it will write it to disk at the real location.
I have never used File > Save a Copy As when I am in that unsaved-periodic-backup state; I don’t know whether it uses the file-in-memory for making a copy of, or whether it makes a copy of the file-on-disk. Either way, I would highly recommend always saving before telling any application to make a copy, and being wary of leaving a file in the unsaved-but-Notepad+±does-periodic-backup state for too long. Save early, save often.
@PeterJones said in File disappeared:
I have never used File > Save a Copy As when I am in that unsaved-periodic-backup state
The reason: because I don’t assume that leaving a file unsaved and exiting the program is a safe thing to do, so I disable that option except when I’m running experiments.
Speaking of running experiments. I ran some.
I had an unsaved
new 1, exited with periodic backups, came back in, made edits, and did Save a Copy As without first saving the file-being-edited. It copied the contents of the active editor into the new file. I then exited (still with
new 1showing unsaved changes), came back, made more active changes to the unsaved file, and did Save a Copy As, and it copied those most recent changes to the new file.
I also experimented with the old-style save dialog: yes, if I type the name as
newname.(with the period) when saving, it won’t append the
.txtdefault extension. If I type just
newname, it will append the default
.txtextension. And in the wonderful bugginess of that outdated, deprecated, and horrific MS Windows-created dialog box, if I File > Open to a file with no extension, while that Files of type selector is set to
Normal text file (*.txt), and click on
savecopy3(which has no extension), when it opens, Windows will tell Notepad++ that the file that I clicked on does not exist:
Microsoft (Windows) encouraging every app to switch to the new style dialog was one of the smartest decisions in UI I’ve seen out of MS. However, Don had implemented both versions during the transition time, when everyone was asking “why can’t I click on Libraries in the Open dialog anymore” (or some such reason – I wasn’t involved with Notepad++ Community or the old sourceforge forum back then). At this point in time, it gives people an option, and there’s no good reason to remove that option. (And there are two good things about the old-style dialog: 1) you can click on Libraries, which I thought MS shouldn’t have deemphasized in the modern UI; 2) you could use real slashes rather than windows backslashes when typing paths. Other than people still liking those, I see no reason to ever use the old-style dialog; but if Don wants to leave it as an option for the change-resistant and for those who like one or both of those features, I won’t fight it.)
Alan Kilborn last edited by
I have never used File > Save a Copy As when I am in (changed: ANY) unsaved state
I have never even thought about that situation.
It is interesting to know what it does, though, for that case.
For myself (and I suspect people over a certain age – Peter?), I first and foremost think of dealing with “saved data”.
[Save, save, SAVE, save, Save…]
Anything else is just asking/begging for trouble…
[Save, save, SAVE, save, Save…]
@PeterJones: Thanks for your lengthy response. To clarify, the issue started when Notepad++ wouldn’t let me save my changes to the file with no extension (I did not change the default setting of “Use new style dialog” enabled). The message was something like “the file is already open,” which made no sense. That’s why I closed it without saving, thinking that, like every piece of software I’ve ever used, it would detect the unsaved state and ask me if I wanted to save, but it didn’t. Today from your response, I see that, since I had the default setting of “Enable session snapshot and periodic backups” enabled, it allowed me to exit without saving because it was backing up the files. That is why, when I opened the file again, it opened the three files I had open, including my changes that I wanted to save. At this point I’m relieved because my changes are still there. But after the next time I saved, they were gone (I can’t remember the exact sequence of events that occurred during the second session)
One further wrinkle is that I am using Microsoft One Drive, which is supposed to automatically save [some number of?] changes to all files – but when I right-click one of the files in question in File Explorer and invoke “Restore Previous Version,” it says that there aren’t any.
The message was something like “the file is already open,”
The only message that I can think would come close would be a message that the file was already open (and locked) in another program. But I just tried locking a file (with no extension) from another program, then tried to
echo something >> blahand both told me
The process cannot access the file because it is being used by another processor similar; but when I opened and saved in Notepad++, it didn’t complain at all; in the end, the process that had locked the file won, because the values it wrote were the ones in the file (and Notepad++ even saw the changes, and reloaded the file with the values from the other process). So I really don’t know what event would cause the error you described.
I can’t remember the exact sequence of events that occurred during the second session
Unfortunately, you have not described things with sufficient detail for us to try to replicate your problem, or help you avoid it in the future. Saving files with no extensions has always worked for me, and I’ve never had a “the file is already open” message (that I can recall). At which point, I’m not sure what else we can do, except express our condolences, or wait for a more detailed explanation from you or someone else who has seen a similar problem.
If any other person on the Forum sees things differently, or is able to replicate the problem or give additional help, please speak up.
Otherwise, if you have more evidence for us, let us know, and we’ll try to help. But unfortunately, as it is now, you have given us a request for help without sufficient information to help you.
@PeterJones: Again, thanks very much for your quick and thorough response! Of course, without the exact sequence of events and messages, it’s impossible to reproduce the problem. Usually basic operations liking open, close, save don’t cause problems, so I was not in the kind of frame of mind in which I was carefully recording everything I did and everything the app did. Still it is weird that, when I shut down Notepad++ and started it up a second time, my changes were there, but when I shut it down and started it up a third time, they were gone. I looked in the backup location and the recycle bin, but no luck. Only ways that could happen that I can think of: either I removed the changes myself in Notepad++ (which I didn’t), or I accidentally deleted the file (which would have put it into the recycle bin). Have to just chalk it up to a glitch of some kind.