Unsaved Files Recovery Script
-
#recover files, #update, #deleted
I hope this is helpful.
CheersREADME.md
Notepad++ Unsaved Files Recovery Script
Purpose
This script was created to address a common issue with Notepad++. For years, the developers of Notepad++ have been either lazy, irresponsible, or oblivious to their loyal users’ data integrity. It’s difficult to count how many people have lost their data after updating the application. They have adopted a Microsoft-style approach of ignoring the obvious.
After experiencing the loss of my files during the latest update today, I searched online for answers and commonalities. I was shocked to see the sheer number of hits my search returned. However, I was not prepared for the pompous, egotistical tone of responses preaching “best backup” practices to those seeking a solution—not a lecture.
With over 40 years of development experience, I refuse to waste my time reading these pointless backup manifestos that serve only to stroke the writers’ egos while doing nothing to solve the problem. So, I sat down and created an immediate solution for those who need help now.
The script I wrote can be used (with minor modifications) for Windows, Mac, and Linux environments. I developed it specifically for my personal Linux environment. Before I explain the solution, I’d like to offer some helpful and free advice to the Notepad++ developers.
For Notepad++ Developers
The Issue
Notepad++ has long been a favorite tool for users due to its flexibility and reliability as a scratchpad for quick note-taking, code editing, and document drafting. Users have come to rely on its ability to retain unsaved documents across sessions, fostering a convenient workflow. However, this convenience has unintentionally created a dangerous false sense of security.
The application allows users to create and work on unsaved documents seamlessly, leading many to forego traditional saving habits. Over time, this behavior becomes second nature, as users trust the application to “just work.” Unfortunately, this trust is shattered during updates. Notepad++ lacks even the most basic safeguards to ensure data integrity during this critical process. Unsaved documents can disappear entirely without warning, leaving users with no recourse to recover their work.
This glaring oversight reveals a profound lack of understanding—or perhaps indifference—on the part of the developers regarding their user base. Most users are not developers; they rely on Notepad++ as a reliable tool, not a product that demands meticulous configuration. The responsibility for maintaining data integrity should not rest solely on the shoulders of the user, especially when the software design itself encourages reliance on unsaved documents.
It is disappointing that the developers have not implemented basic measures such as pre-update warnings, automatic backups, or a simplified recovery process. This lack of foresight undermines user trust and tarnishes the reputation of an otherwise excellent tool. By failing to address these critical gaps, the developers have effectively transferred the onus of responsibility for data loss onto the very users who have supported their product for years.
Free Advice
Best Practices Developers Should Follow to Maintain User Data Integrity
- Automatic Backup: Implement a robust and automatic backup system that saves all unsaved files to a dedicated and user-accessible directory before updates or shutdowns.
- Update Pre-Check: Add a pre-update verification process that scans for unsaved or open documents and prompts the user to review and save them.
- Recovery Mechanism: Provide a built-in recovery feature that restores unsaved files after crashes, updates, or improper shutdowns.
- User Notifications: Display clear and unmissable warnings about the risks of losing unsaved data during updates or unplanned shutdowns.
- Simplified Preferences: Ensure preferences related to file saving and backups are intuitive and prominently accessible to users.
- Version Compatibility: Ensure backward compatibility for unsaved documents and saved sessions across versions.
- Data Validation: Before updates, validate the integrity of open documents, ensure they are saved or backed up, and provide the user with a choice to proceed or cancel the update.
- Default Save Directory: Automatically set up a default directory for unsaved files and ensure users are aware of its location.
- User Education: Include onboarding messages or tutorials for new users that explain how the backup and recovery features work.
- Comprehensive Logging: Log updates, backups, and recovery attempts to help users and developers troubleshoot data loss issues.
Areas Where Notepad++ Falls Short in Guaranteeing User Data Integrity
- False Sense of Security: By allowing users to close and reopen the application without saving files, the software fosters a dependency on unsaved files being retained without warning users about potential risks.
- Lack of Update Safeguards: Updates are carried out without checking for unsaved documents or notifying users of potential data loss.
- No Validation or Verification: There is no mechanism to validate whether all unsaved work is safely stored before performing potentially disruptive actions like updates or crashes.
- Unintuitive Preferences: The backup and recovery settings are buried in complex menus, making it difficult for non-technical users to configure or locate them.
- Inadequate Warnings: Users are not explicitly warned about the risks of losing unsaved files during updates, leading to unexpected data loss.
- No Default Backup Directory: The lack of a default backup location means users must manually configure backups, which is not user-friendly.
- Absence of Recovery Options: There is no fallback recovery mechanism for retrieving unsaved files after unexpected data loss.
- Developer Accountability: The responsibility for ensuring data safety is shifted entirely to the user without acknowledging that the application’s design encourages risky behavior.
Example Code Snippet for a Warning Dialog Before Updates
import tkinter as tk from tkinter import messagebox def pre_update_warning(): root = tk.Tk() root.withdraw() # Hide the main window unsaved_files = check_unsaved_files() # A function that checks for unsaved files if unsaved_files: message = ( "Warning: The following unsaved files were detected:\n\n" + "\n".join(unsaved_files) + "\n\nUpdating Notepad++ may result in permanent loss of these files.\n" "Do you want to save them before proceeding?" ) user_choice = messagebox.askyesnocancel("Unsaved Files Detected", message) if user_choice: # Yes save_unsaved_files(unsaved_files) # Save the files elif user_choice is None: # Cancel print("Update canceled by the user.") return False else: messagebox.showinfo("No Unsaved Files", "No unsaved files detected. Proceeding with the update.") # Proceed with the update return True def check_unsaved_files(): return ["document1.txt", "document2.txt"] def save_unsaved_files(files): for file in files: print(f"Saving {file}...") if pre_update_warning(): print("Updating Notepad++...")
Script Overview
This Bash script searches for unsaved files in Notepad++ backup directories and optionally scans additional system directories for temporary files. The script provides options to log file paths, copy all files, or selectively copy files to a specified backup directory.
Features
- Searches Notepad++ default backup directory.
- Optionally scans additional directories (e.g.,
/tmp
,/var/tmp
). - Supports multiple file patterns (
*.npp*
,*.tmp
,*.bak
,new *
). - Logs file paths, copies all files, or selectively copies files based on user input.
- Ensures that all operations are user-controlled and customizable.
Requirements
- A Linux environment with Bash installed.
- Read/write access to the user’s home directory and other optional directories.
Default Directories and File Patterns
-
Default Backup Directory:
/home/<username>/snap/notepad-plus-plus/common/.wine/drive_c/users/<username>/AppData/Roaming/Notepad++/backup
-
Additional Directories (optional):
/tmp
/var/tmp
$HOME/.cache
$HOME/.config
-
File Patterns Searched:
*.npp*
*.tmp
*.bak
new *
How to Use
-
Clone or download the script to your local machine.
-
Make the script executable:
chmod +x <script_name>.sh
-
Run the script:
./<script_name>.sh
Script Workflow
-
Prompt for Username:
The script asks for the username to identify the correct backup directory. -
Search Default Backup Directory:
Searches the Notepad++ backup directory for matching files and copies them to a designated backup folder. -
Prompt for Additional Directories:
Asks the user if they want to scan additional directories. -
Operation Modes:
If additional directories are included, the user chooses one of the following modes:- Log Only (LO): Log file paths without copying.
- Copy All (ca): Copy all matching files without further prompts.
- Copy Individually (ci): Prompt for each file to decide whether to copy it.
-
Output:
- All copied files are stored in
~/Documents/Notepad++_Backup
. - Logged file paths are stored in
~/notepad_unsaved_files.log
.
- All copied files are stored in
Example Run
=============================================== Searching for Notepad++ Unsaved Files =============================================== Enter your username: santa Processing Notepad++ backup directory (snap)... -> Copied: /home/santa/snap/.../backup/file1.npp -> /home/santa/Documents/Notepad++_Backup/file1.npp Do you want to search additional directories (/tmp, /var/tmp, etc.)? (y/N): y Additional directories may find hundreds of files. You will be asked to back each file up individually or choose to only log files found. Do you want to (L)og (O)nly the findings, (C)opy (A)ll files, or (C)opy (I)ndividually? (LO/ca/ci): ci Searching in: /tmp Found file: /tmp/file2.tmp Do you want to save this file? (y/N): y -> Copied: /tmp/file2.tmp -> /home/santa/Documents/Notepad++_Backup/file2.tmp ... Search complete. Results: - Backup saved to: /home/santa/Documents/Notepad++_Backup - Log file saved to: /home/santa/notepad_unsaved_files.log
Customization
Modify Directories and Patterns
- Edit the
SNAP_BACKUP_DIR
,ADDITIONAL_DIRS
, andFILE_PATTERNS
variables to customize search locations and file patterns.
Change Default Behavior
- Adjust the default operation mode by modifying the
OPERATION_MODE
variable in the script.
Notes
- Ensure the script has proper permissions to access the specified directories.
- Avoid running the script as
root
unless necessary.
License
This script is provided “as is” without warranty. Use it at your own risk.
Porting the script to Windows and Mac environments
This script requires a systematic approach to account for differences in file systems, commands, and shell environments. Here’s a step-by-step plan:
-
Identify Platform-Specific Differences
Linux-Specific Elements- The script relies on Bash (#!/bin/bash) and Linux utilities like find, cp, mkdir, and directory structure assumptions.
- Paths, such as ~/snap/…, will differ on Windows and Mac.
Windows - Use PowerShell or Batch scripts instead of Bash.
- The default Notepad++ backup directory is located in a different location (e.g., %AppData%\Notepad++\backup).
Mac - Use Bash/Zsh (Mac comes with these pre-installed).
- Verify if Notepad++ is installed under a Wine environment or replace with a similar Mac-native app’s backup directory.
-
Abstract Environment-Specific Code
- Create variables for platform-specific paths:
Use $HOME on Linux/Mac
Use %USERPROFILE% on Windows - Wrap platform-dependent commands in conditionals:
if [[ "$(uname)" == "Darwin" ]]; then # Mac-specific code elif [[ "$(uname)" == "Linux" ]]; then # Linux-specific code elif [[ "$OS" == "Windows_NT" ]]; then # Windows-specific code (e.g., PowerShell or Batch commands) fi
- Create variables for platform-specific paths:
-
Paths and Commands
- Windows:
- Replace paths like /tmp, /var/tmp, and ~ with %TEMP%, %LOCALAPPDATA%, and %USERPROFILE%.
- Use PowerShell commands like Get-ChildItem (analogous to find) and Copy-Item (analogous to cp).
Example PowerShell equivalent for find:
powershell
Get-ChildItem -Path “C:\Users$env:USERNAME\AppData\Roaming\Notepad++\backup” -Filter “.npp” -Recurse
- Mac:
- Similar to Linux. Confirm Wine’s installation paths if Notepad++ is run under Wine.
- Mac may have /tmp and similar directories, so much of the Linux logic can be reused with minor modifications.
- Windows:
-
Platform-Specific Packaging
- For Linux/Mac: Keep the script in Bash or port it to Python.
- For Windows:
- Convert the script to PowerShell or Batch.
- Alternatively, bundle a Python script with pyinstaller to create a .exe for Windows users
-
Directory Path Adjustments
- For Linux:
- “SNAP_BACKUP_DIR=”$HOME/snap/notepad-plus-plus/common/.wine/drive_c/users/$user_name/AppData/Roaming/Notepad++/backup"
- For Windows (PowerShell):
- "$backupDir = “$env:USERPROFILE\AppData\Roaming\Notepad++\backup”
- For Mac (Bash):
- “BACKUP_DIR=”$HOME/.wine/drive_c/users/$USER/AppData/Roaming/Notepad++/backup"
- For Linux:
Visual Flow Map for Notepad++ Unsaved Files Script
flowchart TD A[Start Script] --> B[Prompt for Username] B --> C[Set Default Paths and Patterns] C --> D{Search Additional Directories?} D -->|Yes| E[Prompt for Operation Mode] D -->|No| F[Search Snap Backup Directory] E -->|LO| G[Log Files Found] E -->|CA| H[Copy All Files Found] E -->|CI| I[Prompt: Copy Files Individually] F --> J[Search and Copy Snap Backup Files] G --> K[Log Additional Directory Files] H --> L[Copy Additional Directory Files] I --> M[Prompt for Each File] J & K & L & M --> N[Display Results and Exit]
Script in next post.
-
This is the second and final part to my post.
find_notepad_unsaved_files.sh
#!/bin/bash # ============================================================================== # Date: 2025-01-24 # Description: # This script searches for unsaved Notepad++ files within the user's snap # directory and optionally in additional directories such as /tmp or # /var/tmp. The script provides options to either log, copy, or selectively # copy files found. Results are saved in a specified backup directory and # optionally logged to a file. # Usage: # 1. Ensure you have the necessary permissions to access the specified # directories and files. # 2. Run the script in a terminal: # ./script_name.sh # 3. Follow the prompts to provide your username and choose search options. # Example: # ./script_name.sh # Enter your username: johndoe # Do you want to search additional directories? (y/N): y # Do you want to (L)og, (C)opy (A)ll, or (C)opy (I)ndividually? (LO/ca/ci): ca # Written by: (TheProfessorWhoFailedYourSorryAss) # ============================================================================== echo "===============================================" echo "Searching for Notepad++ Unsaved Files" echo "===============================================" # Text-Based Flow # ------------------------------------------------------------------------------ # 1. Display script banner. # 2. Prompt the user to enter their username. # 3. Set default search paths, file patterns, log file, and backup destination. # 4. Ask the user if they want to search additional directories. # - If yes, prompt for an operation mode: # - (LO) Log files only. # - (CA) Copy all files. # - (CI) Copy files individually. # - If no, default to copying all files from the Notepad++ snap backup # directory. # 5. Search for files in the Notepad++ snap backup directory. # - For each matching file: # - Copy the file to the backup destination. # 6. If additional directories are searched: # - For each directory and pattern combination: # - Perform the selected operation mode (Log, Copy All, or Copy # Individually). # 7. Display results and exit: # - Backup location. # - Log file location (if applicable). # ------------------------------------------------------------------------------ # Prompt the user to enter their username read -rp "Enter your username: " user_name SNAP_BACKUP_DIR="$HOME/snap/notepad-plus-plus/common/.wine/drive_c/users/$user_name/AppData/Roaming/Notepad++/backup" ADDITIONAL_DIRS=("/tmp" "/var/tmp" "$HOME/.cache" "$HOME/.config") FILE_PATTERNS=("*.npp*" "*.tmp" "*.bak" "new *") LOG_FILE="$HOME/notepad_unsaved_files.log" BACKUP_DEST="$HOME/Documents/Notepad++_Backup" # Ask the user if they want to search additional directories read -rp "Do you want to search additional directories (/tmp, /var/tmp, etc.)? (y/N): " ADD_ADDITIONAL ADD_ADDITIONAL=${ADD_ADDITIONAL,,} # Convert to lowercase # If additional directories are included, ask the user for the operation mode if [[ "$ADD_ADDITIONAL" == "y" ]]; then echo "Additional directories may find hundreds of files." echo "You will be asked to back each file up individually or choose to only log files found." read -rp "Do you want to (L)og (O)nly the findings, (C)opy (A)ll files, or (C)opy (I)ndividually? (LO/ca/ci): " OPERATION_MODE OPERATION_MODE=${OPERATION_MODE,,} # Convert to lowercase else OPERATION_MODE="ca" # Default to copying all files in the snap directory if additional directories are not searched fi # Function to copy files copy_file() { local file=$1 local dest_dir=$2 local filename filename=$(basename "$file") local dest_file="$dest_dir/$filename" mkdir -p "$dest_dir" cp "$file" "$dest_file" echo "-> Copied: $file -> $dest_file" } # Function to log files log_file() { local file=$1 echo "$file" >> "$LOG_FILE" echo "-> Logged: $file" } # Restrict file search to the snap backup directory by default echo "Processing Notepad++ backup directory (snap)..." mkdir -p "$BACKUP_DEST" for pattern in "${FILE_PATTERNS[@]}"; do find "$SNAP_BACKUP_DIR" -type f -name "$pattern" -prune 2>/dev/null | while read -r file; do copy_file "$file" "$BACKUP_DEST" done done # If the user opts to search additional directories if [[ "$ADD_ADDITIONAL" == "y" ]]; then for dir in "${ADDITIONAL_DIRS[@]}"; do echo "Searching in: $dir" for pattern in "${FILE_PATTERNS[@]}"; do find "$dir" -type f -name "$pattern" -prune 2>/dev/null | while read -r file; do case "$OPERATION_MODE" in lo) log_file "$file" ;; ca) copy_file "$file" "$BACKUP_DEST" ;; ci) echo "Found file: $file" read -rp "Do you want to save this file? (y/N): " choice choice=${choice,,} # Convert to lowercase if [[ "$choice" == "y" ]]; then copy_file "$file" "$BACKUP_DEST" else echo "-> Skipped: $file" fi ;; *) echo "Invalid operation mode. Skipping file: $file" ;; esac done done done fi echo "Search complete. Results:" echo "- Backup saved to: $BACKUP_DEST" echo "- Log file saved to: $LOG_FILE"
Hope this helps.
Cheers. -
@Private-Confidential said in Unsaved Files Recovery Script:
False Sense of Security: By allowing users to close and reopen the application without saving files, the software fosters a dependency on unsaved files being retained without warning users about potential risks.
This is the first, and only illuminating fact of the entire diatribe, but one that hardly needs restating, as it has always been the problem. Someone shutting off the warning, because they are annoyed, someone not reading the manual, because they are annoyed to have to read, but most importantly, being stupid enough to NOT save documents initially and often, or to back up, period.
Here’s a more fool-proof and time tested procedure.
- Save all documents currently in tabs, and close.
- Update
- Reopen necessary documents via the MRU list, or Document List, or Project panel.
- Continue working.
There, simplified and solved the problem without adding another ad nauseum program to help stupid people keep from self destructive behavior…however, like using your program, I can almost guarantee these steps won’t be followed because they are too intrusive, exhausting or bothersome to be concerned about, after all, that’s what the session is for…and you can now see, that your first point is the only non-changing variable that is completely out of anyone’s control except for the user themselves, and you can’t fix stupid. Period. At best, you give them another crutch they most likely won’t be bothered to use, setup or follow directions, because as usual, they can’t be expected to learn about the proper saving and back up necessary for safe-guarding their work.
Done stroking ego and writing yet another back up manifesto. :-)
On a side note: Thank you for the taking the time, and talent, to add to the possible solutions that someone could follow, outside of normal conscientious habits, which is well learned by experience, if learning by said individual is at all possible, at that point.
-
@Lycan-Thrope
Thank you for taking the time to read my README and for sharing your perspective. I appreciate anyone who takes the time to engage in these discussions, especially when it’s about a critical topic like user data integrity.I wanted to clarify a few points and provide some context for my motivation in creating this script and accompanying README. While I acknowledge that the tone of my critique might come across as pointed, it’s rooted in years of seeing the same frustrations repeated by countless users—frustrations caused not by user negligence alone, but by design oversights that have created and perpetuated the problem.
"The first, and only illuminating fact..."
While I respect your acknowledgment of the “false sense of security” issue, I feel that this was just one piece of the larger picture I presented. My README wasn’t simply a critique of Notepad++’s shortcomings; it was also an attempt to propose actionable solutions for addressing those gaps, both in the long term (design changes) and short term (a recovery script). What I was striving for wasn’t a “diatribe” for its own sake, but a combination of highlighting the problem and empowering users with a stopgap solution until those responsible address it.
The "fool-proof procedure"
Your suggested process is logical for those of us with technical knowledge, but it misses the realities of how most users interact with Notepad++ (and many other applications). Many users see it as a quick tool—a scratchpad or jotting board where they can brainstorm or capture thoughts on the fly. The implicit promise in the way Notepad++ functions is that their unsaved work is safe. This behavior isn’t “stupid”; it’s a direct response to how the software has conditioned its users. As developers (or those critiquing development), we need to understand that design should work with user habits, not expect users to modify their habits to account for design limitations.
"You can’t fix stupid."
I strongly disagree with this sentiment. Users are not “stupid.” They are varied, with different skill levels, needs, and workflows. Great software design accounts for these variations. It doesn’t dismiss users for behaving in ways that the software encourages. If users frequently lose their work due to updates, that’s not an indictment of the user; it’s a signal that the software has failed to safeguard their data. Solutions like pre-update warnings, automated backups, and recovery mechanisms aren’t “crutches” but thoughtful ways to respect and protect users’ work.
My effort to help has been met with what I’ve observed from others in this community: a tendency to take constructive criticism as a personal attack and code enhancement suggestions as an insult to their intelligence. This response, unfortunately, highlights a systemic issue within certain development communities. What disappointed me most about your reply was its focus on perceived negativity while overlooking the constructive efforts I’ve made. I didn’t just highlight the shortcomings of Notepad++; I offered sound, actionable solutions to improve the software and created a recovery script that users can implement immediately to address a critical pain point. This wasn’t about posturing or being “alpha”; it was about solving a problem that has caused frustration for countless people.
In conclusion, I welcome discussions like these because they help us get closer to meaningful solutions. But I’d also like to see more focus on understanding the problem from a user’s perspective. Blaming users or dismissing them as “stupid” doesn’t move the conversation forward. By highlighting the shortcomings of Notepad++’s design and providing both long-term and short-term solutions, I believe I’ve contributed positively to this dialogue.
Thank you again for engaging in this conversation, and I genuinely hope we can work toward a shared goal: empowering users and ensuring their data is safe.
-
@Private-Confidential ,
Well, there is one possible solution for this, and I guarantee it won’t be popular, and that is to just remove the Session capability period. Then, no one will be under any false sense of security with regards to their documents.I can appreciate your arguments, but as someone that used to be remote staff for AOL that helped people get on the internet, and tried to teach them netiquette and to not think everything posted on it was accurate, I have since lost my belief that people that can not use a commandline, are smart. Cynical, maybe, but I’m from the school of thought that the best teacher in life, is experience, and if that experience is unpleasant, that lesson is more ingrained. The ‘Save’ button is the only foolproof back up mechanism one needs.
I have issues with Android apps that didn’t specifically allow me to ‘Save’ my documents, for this very reason, that I learn first where it saves it, and that I can save it. I don’t believe people should rely on technical solutions to their work life, as things that are digital are prone to failure, period. If that lesson of losing one’s work makes an indelible impression on them to always save their work, then so be it. It is not a design deficiency of this program, nor a lapse of developer concern, in my opinion, to not allow one to escape ‘common sense’ security measures to insure their work. If anything, I consider the Session aspect a grace period one can take advantage of when they are ‘in the zone’, but it is no more than that, to me. Anyone thinking it is more, is in for disappointment. This is regardless whether you and I are old hands at technology, or not. These are lessons we learned the hard way, regrettfully, but they were learned and impressioned upon us. I expect the next generation to be no less learned, if they expect to protect themselves, rather than being dependent on an external entity to save them from themselves. That is the purview of a deity, not other humans to provide.
-
@Lycan-Thrope said in Unsaved Files Recovery Script:
Well, there is one possible solution for this, and I guarantee it won’t be popular, and that is to just remove the Session capability period. Then, no one will be under any false sense of security with regards to their documents.
I agree with you, but I’m also certain we are old folks yelling at clouds.
[The remaining 3500 characters of this post have been redacted as they are just an old man yelling at clouds.]
-
@Lycan-Thrope said:
just remove the Session capability, period
@Coises said:
I agree with you
Specifically, the talk is about removing this checkbox (checkmarked by default!) and the behavior it enables:
Removal of the behavior would force users to save (to file in the file system) or discard all untitled (e.g. “new 1”, “new 4” , etc., or renamed-but-not-user-saved) tabs in existence when Notepad++ is being exited.
In roughly a decade (has it been that long?) of using Notepad++, I’ve never operated with that checkbox checkmarked. But I agree 100% that it should go away. Why? So I can stop reading postings here about people losing data because of it.
And yes, this is just more cloud-shouting. It will never go away, and data loss because of it will probably also never go away.
-
Response to Discussion on Notepad++ Session Persistence and Data Loss
First, I appreciate the discussion and the different perspectives being shared. I understand that some users, particularly those who have always been diligent about manually saving their work, might view the session feature as an unnecessary crutch. However, I believe it’s worth considering why this feature exists in the first place and why so many users rely on it.
The Case for Keeping Session Persistence
Notepad++ has been around for over two decades, and during that time, session persistence has become an integral feature that many users—myself included—have come to depend on. It’s not about laziness or carelessness; it’s about workflow efficiency and user experience.
For users like myself, who have fast-moving thought processes and often need to jot down ideas quickly, session persistence is invaluable. I have ADD, and if I don’t write something down immediately, it’s gone. This feature has allowed me to function more effectively in both my personal and professional life. I suspect that many others, whether neurodivergent or simply accustomed to this workflow, feel the same way.
We should also ask ourselves: If so many users are reporting data loss, is the problem with them—or with the design of the software? Over time, habits are formed. If users have been relying on session persistence for years, expecting it to work seamlessly, then sudden data loss due to an update isn’t just a “user error” issue—it’s a product design issue.
Observations on Preferences and Backup Options
The Backup Preferences Module:
- There is no clear explanation of how session persistence interacts with updates.
- There is no hover help or clear UI guidance to indicate the risks associated with unchecked settings.
- There is no option for ensuring persistence across updates.
The General Preferences Module:
- It’s cluttered and overwhelming.
- The session settings don’t clearly communicate their importance or impact.
While some argue that removing session persistence entirely would prevent users from relying on it, I’d counter that a more balanced approach would be improving how the feature is managed and communicated to users.
The Real Problem: Communication & User Expectation
If an update risks wiping out unsaved session data, the least path of resistance to solving the issue is not removing the feature, but rather:
- Providing a warning before an update if unsaved session files exist.
- Ensuring the update process does not clear session data unless explicitly approved by the user.
- Improving the UI to make session persistence and backup settings clearer and more accessible.
It’s easy to say, “Just save your work.” But the reality is that Notepad++ has conditioned users to expect their unsaved work to persist. To now turn around and blame them for losing data when the feature fails is unfair.
A Thought Experiment: Why Was This Feature Implemented in the First Place?
From a forensic investigation stand point, this feature is priceless. It provides a traceable session history that can be invaluable in certain situations. If the developers originally implemented it to enhance user experience, why is the conversation now shifting toward removing it? Instead of eliminating a useful feature, we should be asking: How do we improve it to prevent unintended data loss?
Final Thoughts
I recognize that long-time users who manually save their work may not see the issue the same way as those who rely on session persistence. However, the sheer number of users reporting lost work suggests that this is a significant problem, not just a case of “user negligence.”
Rather than taking a “You can’t fix stupid” approach, let’s acknowledge that:
- The feature exists for a reason.
- Many users rely on it—sometimes out of necessity, not carelessness.
- The problem isn’t the feature itself but the way it is managed and communicated.
- The best solution isn’t removing the feature but improving its reliability and user awareness.
I appreciate the discussion and welcome further thoughts on how Notepad++ can better serve all of its users—without unnecessary frustration or preventable data loss.
I have a quick question, are any of you NPP decision makers or developers? I ask this because I’m not familiar with code and I would be interested in a more technical discussion regarding feasibility of what we are discussing.
-
@Private-Confidential said:
I believe it’s worth considering why this feature exists in the first place
IMO it exists because 20+ years ago the author of Notepad++ thought that it was a reasonable, and even good, feature.
and why so many users rely on it.
IMO, they get used to it because it is the default behavior.
And also, for some bizarre reason, they have no reason to have a “real file” from their data, and they enjoy looking at “new 1”, “new 4”, “new 27” tab titles (because probably many don’t know that you can rename a tab without truly saving it – another dubious “feature”).
And, it works fine for many users – but these users are “unsuspecting”.
They are not informed about other users losing data with it, UNTIL it happens to them and then they come here and post about it – but by then it may be “too late”.My advice:
Do not use this feature. This makes all the “talk” and the “recovery script” (which is of dubious use anyway, due to “Platform-Specific Packaging”) unnecessary.
As needed, create a new tab, and immediately save it into the file system (and then proceed to “care” for this file from there, i.e., backing up). -
Hello, @private-confidential, @lycan-thrope, @coises, @alan-kilborn and All,
I’ve known
Notepad++
for about 12 years now and, since the first time that theSession snapshot and periodic backup
feature was implemented, in release6.6
, I always uncheck this terrible option !I do want to save all my files correctly and decide, where and when it’s time to back-up ( I generally do two back-up : one a simple USB key and an other on an external Hard-Disk drive )
Each time I get a new portable version of N++, the very first thing that I do is :
-
Go to the
Settings > Preferences... > Backup > Session snapshot and periodic backup
panel -
Uncheck the default
Session snapshot and periodic backup
option -
Close and restart N++ to be sure that this option is disabled
-
Then, I can safely discover all the goodies of the latest release !
Believe me : I’ve never had any trouble of lost files, even when not related to N++ itself !
Remember : three things are certain in this world : Birth, Death and Data Loss. You control the last !!
Best Regards,
guy038
-
-
@Private-Confidential said in Unsaved Files Recovery Script:
For users like myself, who have fast-moving thought processes and often need to jot down ideas quickly, session persistence is invaluable. I have ADD, and if I don’t write something down immediately, it’s gone. This feature has allowed me to function more effectively in both my personal and professional life. I suspect that many others, whether neurodivergent or simply accustomed to this workflow, feel the same way.
This is in no way meant to insult you.
Unfortunately for you, I too, am ADHD, and have learned to deal with and work with that gift all my life. It’s not a handicap, a crutch or an excuse, it is a superhero power. However, like all skills, talents and ‘superpowers’ it must be trained, honed and disciplined to be used for good, rather than bad purposes. My wife tells me I am also OCD (I am) as well, to which I quip, you make that sound like it’s a bad thing?My point in this, is that there are ‘habits’ that one forms, consciously, that allows one to overcome what can be deficits, and make them strengths. I’ve described one of them to you already, and that is obsessive back up of files. When I don’t and I lose data…guess who I blame? ME!!
My counter argument to you, is that the premise for your suggestion and solution, is dependent on the focus and importance you place on the reason that it needs to be addressed. ‘Normal’ (ungifted) people, don’t have that problem. They don’t lose their train of thought, or can stay on it. We can’t. Therefore, the solution to problems we encounter, are contingent upon us to go that extra mile for our own defense.
I had a gym teacher in high school, who had the same problem, and you know what his advice to me was? “We have to work harder, just to stay normal”. Words I’ve lived by since then, and also from my mother who had the same issue, and taught me to ‘focus’.
This feature, is not supposed to be a crutch, it is a temporary safety, for just the situation you mention; the capture the thought before it gets away, need. Your assertion is that the feature entraps the user to learn bad habits, and I challenge that premise, that it is up to the user to maintain solid habits, so they don’t become a victim to complacency. That is everyone’s challenge, normies and ‘neurodivergent’.
For me, your argument will have to evolve off of the prevent people from being lazy, forgetful (which the feature acutally helps) or complacent. If they have that much data in the wild without saving it, it is their own fault, and I don’t think you’re going to be able to discuss or frame it in any other light.
What the developer may decide to do, is one thing. If you want to take a crack at the code, the open-source code is available to make what you want to happen, and submit it to the developer for review and consideration. Your script, may work for others that want that “saving grace” option, and now are welcome to use it, which is why I thanked you for your contribution to give them another tool/crutch, (depending on your perspective) so they can overcome their erroneous understanding of the purpose and use of the Session feature. Other users, who have discussed with you here, that they don’t find it even necessary, let alone the blame for data loss should give you some pause. Most people that are programmers/computer geeks that I know, all have the same ADHD/ADD tendency that they have learned to harness, yourself included, apparently.
For the people that just use it as a Notepad replacement, it already meets their needs. For those that need more, it’s incumbent on them to learn more. Like myself. Until I needed to learn how the UDL system works, so I could create my own UDL Package for my programming language, I was blissfully ignorant and happily content to use it as a text editor with some extra abilities, totally oblivious to the Session feature, because as someone who understand basic computer usage, and knows data loss happens, I saved whatever I needed to save. Period.
-
Alan, I appreciate your engagement with this topic, but I must point out that your claim that the recovery script is “of dubious use” due to “Platform-Specific Packaging” is both inaccurate and misleading.
If you had taken the time to review the README file, you would have seen that I’ve provided a detailed breakdown of how to adapt the script for Windows, Mac, and Linux environments. To recap:
Platform-Specific Adjustments The script already accounts for differences in file paths and shell environments (Bash for Linux/Mac, PowerShell/Batch for Windows). It includes conditional logic (if [[ "$(uname)" == "Darwin" ]]; then … elif [[ "$OS" == "Windows_NT" ]]; then …) to ensure cross-platform compatibility. Windows Adaptation Paths like /tmp and /var/tmp are correctly mapped to Windows equivalents (%TEMP%, %LOCALAPPDATA%). The script suggests using PowerShell (Get-ChildItem) or a Python-based solution for maximum compatibility. Mac Adaptation Since Notepad++ is not native to Mac, it outlines how to identify the correct Wine paths for users running it under Wine. Packaging Considerations Linux/Mac users can run the script natively in Bash. Windows users can either convert it to PowerShell/Batch or package it as a Python script using PyInstaller.
So, how is this script platform-specific? If anything, it is designed to be as cross-platform as possible, with clear instructions for adapting it to different operating systems.
Your statement dismisses the script outright without addressing its actual content. If there are specific technical concerns about the cross-platform implementation, I’m happy to discuss them. But vague assertions about its “dubious use” don’t contribute to a productive discussion.
I’m here to solve a problem, and I encourage anyone responding to engage with the actual solutions presented rather than making baseless claims. Let’s focus on improving Notepad++’s data integrity for all users, rather than shutting down efforts that aim to help.
-
@Private-Confidential said in Unsaved Files Recovery Script:
you would have seen that I’ve provided a detailed breakdown of how to adapt the script for Windows, Mac,
You over-estimate the abilities of the Notepad++ user that might be interested.
-
@guy038 Thank you for your response, and I appreciate your perspective on this. However, I feel like an important part of my message has been overlooked.
I ended my last post with a very straightforward question:
“I have a quick question, are any of you NPP decision-makers or developers? I ask this because I’m not familiar with the code and I would be interested in a more technical discussion regarding feasibility of what we are discussing.”
This wasn’t rhetorical—I genuinely want to engage in a technical discussion about how we could implement safeguards without removing session persistence entirely.
What continues to baffle me is that so much of this conversation has focused on criticism and personal philosophies about saving files rather than actual solutions. The most commonly proposed “fix” seems to be removing session persistence altogether, which—let’s be honest—feels like the easiest way to avoid the problem rather than solving it.
Let’s take a step back:
Users are consistently reporting data loss. That’s an undeniable fact. Instead of solving the problem, the response has been to dismiss these users as careless, lazy, or inexperienced. Eliminating persistence altogether punishes users who rely on it. That’s a bandaid, not a solution.
I’d love to move this discussion forward into something constructive. If Notepad++’s current implementation of session persistence has flaws, let’s talk about ways to improve it rather than scrapping it entirely.
For example:
Could there be a built-in session recovery mechanism like many modern editors have? Could there be clearer warnings during updates if unsaved sessions exist? Could we implement a toggleable “safe mode” that reminds users to save periodically without disrupting workflow?
If anyone here has actual insights into Notepad++’s codebase or development, I’d really like to hear about what is technically feasible.
Let’s solve the problem—not just argue about it.
-
@Private-Confidential said in Unsaved Files Recovery Script:
“I have a quick question, are any of you NPP decision-makers or developers? I ask this because I’m not familiar with the code and I would be interested in a more technical discussion regarding feasibility of what we are discussing.”
This wasn’t rhetorical
We’ve got an entire FAQ entry on that. Go check out the first entry in our FAQ section.
Specifically, regarding
If anyone here has actual insights into Notepad++’s codebase or development, I’d really like to hear about what is technically feasible.
There are those here who do have insights into the codebase, as some of the regulars have contributed codebase improvements. But no one here is a decision-maker for the codebase: Don is the one and only absolute decision maker, and he only comes to the Forum for announcements and the like, he does not read discussions like this one.
-
🔹
First off, I appreciate the time and effort you took to respond. I’m not here to engage in an argument, and I want to make it clear that I respect your perspective. However, I feel like there’s a fundamental disconnect in this discussion that I’d like to address.
I understand and agree with a lot of what you said about personal responsibility and forming good habits. You’re right—discipline, structure, and accountability are key factors in both professional and personal success. But I think the core issue here isn’t about personal habits, it’s about software design and user experience.
Let me explain why I think your response is missing the mark:
1️⃣ This isn’t about laziness—it’s about expectations.
Users have been trained to trust that Notepad++ will restore their unsaved work, because that’s how the feature has always behaved. When an update wipes that work out without warning, it’s not just a bad habit issue—it’s a design failure. If a feature creates an expectation, the developers should either ensure it works reliably or warn users explicitly when it might fail.
2️⃣ Not everyone uses software the same way.
I get that you’ve built habits that work for you. That’s great! But not everyone has the same workflow, use case, or cognitive processing style. Some users—myself included—rely on session persistence for reasons beyond convenience. That doesn’t make them reckless or foolish. It means they have a different way of working, and software should accommodate that when possible.
3️⃣ Blaming users doesn’t solve the problem.
I keep seeing variations of the same argument: “Users should just save their files properly.” I don’t disagree that saving regularly is a good practice. But the fact that so many people continue to lose their work suggests that Notepad++ isn’t meeting user expectations in a reliable way. Telling users it’s “their own fault” doesn’t help them recover lost work, nor does it improve the software.
4️⃣ There are practical ways to fix this.
Instead of debating philosophy, let’s talk solutions. A simple pre-update warning for unsaved sessions? A dedicated recovery mechanism? A more intuitive preferences UI that explains session management better? These are all things that could reduce frustration without removing useful features.
I don’t expect everyone to agree with me, and I respect your viewpoint. But I hope we can shift this conversation away from user-blaming and toward actual solutions. Because at the end of the day, the goal is to make Notepad++ better and more reliable for everyone—not just those who already have strong backup habits.
-
Addressing the Underestimation of Notepad++ Users
Alan, I find your response both amusing and concerning. You stated:
“You over-estimate the abilities of the Notepad++ user that might be interested.”
Let’s break that down for a moment.
1. A Curious Contradiction
Notepad++ is a widely used text editor, heavily favored by developers, sysadmins, and power users. In fact, it’s often the go-to tool for those who appreciate lightweight, high-performance alternatives to bloated IDEs. To suggest that its users lack the ability to adapt a well-documented, step-by-step platform-agnostic script contradicts the very nature of the Notepad++ community.
Are you implying that the same users who actively tweak config files, write macros, manage plugins, and even engage in scripting automation cannot follow basic adaptation instructions? That seems like a gross underestimation of the audience.
2. The Irony of Your Argument
Your response essentially implies that:
- Notepad++ users aren’t capable of following simple platform-specific instructions.
- Because of that, I shouldn’t have bothered providing a solution that requires even mild technical competency.
Yet, in the same breath, you advocate for completely removing session persistence, which would force these same users to manually manage their file-saving process—a process that, as you argue, they should already know how to do. Do you see the inconsistency?
3. A Practical Perspective
A well-documented script is not inherently complicated. Here’s why:
- I have provided explicit instructions for adapting the script for Windows, Mac, and Linux.
- The necessary modifications involve changing a few file paths and substituting basic commands.
- For those who prefer a plug-and-play solution, porting to Python and packaging it as an executable is straightforward.
Your assumption that Notepad++ users are incapable of adapting a recovery script suggests an unfortunate lack of faith in the community. It also ignores the reality that a vast number of Notepad++ users have the capability (or willingness) to follow clear instructions, especially when it helps prevent data loss.
4. Let’s Keep the Conversation Constructive
I’m not here to engage in a battle of opinions without substance. I am, however, open to genuine discussions regarding feasibility, implementation, and practical improvements to both Notepad++ and this script.
If you have constructive feedback on how to improve the approach—or, better yet, an alternative solution that doesn’t amount to removing a core feature and calling it a day—I’d love to hear it.
Otherwise, dismissing the effort entirely based on an unfounded underestimation of Notepad++ users serves no purpose other than gatekeeping technical solutions.
5. Final Thought
I’d argue that the true underestimation here is not of Notepad++ users’ capabilities, but rather the willingness to recognize and address a real problem with viable solutions.
I look forward to your response.
-
Thank you for pointing me toward the FAQ. I’ll take a look at that to better understand how decision-making around Notepad++ development actually works.
That said, I do appreciate that some of you have contributed to the codebase, and I’d like to move the discussion in a more constructive direction. My intent was never to debate the merits of personal backup habits—though that discussion seems to have taken on a life of its own. Instead, my goal has been to explore what’s technically feasible in addressing a recurring user issue: unexpected data loss due to reliance on session persistence.
I now understand that Don is the sole decision-maker and doesn’t actively engage in discussions like these. Given that, I’d like to ask those of you who do have experience with the Notepad++ codebase:
- If this issue were to be addressed at the development level, what would be the biggest technical challenges in implementing a safeguard?
- Are there existing constraints within the codebase that make solutions like a pre-update warning, automatic session validation, or improved backup handling impractical?
- Have there been previous discussions or proposals around this, and if so, what were the outcomes?
If the answer is that it’s just not a priority, that’s fine—I just want to understand the technical reasoning rather than continuing in circles about user habits. If there’s a more appropriate channel where technical feasibility is discussed (GitHub issues, a dev mailing list, etc.), I’d be happy to take the conversation there instead.
Ultimately, I’d rather focus on what can be done rather than rehashing why it shouldn’t be done. Thanks in advance to anyone willing to engage in a more technical discussion.
-
@Private-Confidential said in Unsaved Files Recovery Script:
1️⃣ This isn’t about laziness—it’s about expectations.
Users have been trained to trust that Notepad++ will restore their unsaved work, because that’s how the feature has always behaved. When an update wipes that work out without warning, it’s not just a bad habit issue—it’s a design failure. If a feature creates an expectation, the developers should either ensure it works reliably or warn users explicitly when it might fail.
I understand your points, but I fear you do not understand mine. This first statement of yours, is where the logic of your entire premise fails.
They haven’t been trained, or else they would know that you need to backup unsaved work by saving it. This feature was never meant to be used in perpetuity for an unsaved document to be safe. That is the reality, and the weakness in your premise.
Also where your premise dies, is in the
..If a feature creates an expectation...
because the feature never created that expectation. The user not saving their work and they themselves depending on it, created that expectation. If I use a hammer to remove screws, they don’t come out. You can not demand a tool not designed for one job to work for another. The premise is ludicrous, and that’s what I’m getting at. If the user is not qualified to use the tool right, then the safest thing to do, is to take that tool away from that user, until they learn why the tool exists and how to use it properly.That’s why I pointed out that, your argument
will have to evolve off of the prevent people from being lazy, forgetful (which the feature acutally helps) or complacent.
It’s where the reason for your solution, or this discussion or need for the developers to get involved, loses any credibility. It is, in current parlance, ananny-state
solution to a problem that doesn’t truly exist. Rather it is created by a negligent behavior problem. You do not reward negligent behavior, to correct it. You allow the practicing negligent to continue until theyget it
.Anyway, I believe you’ve been directed to the proper area for this discussion to continue to be entertained on github, in the development ecosystem where you can make your complaint, suggestions, and discussions flow…because as @PeterJones points out, this is not the place to argue your case for action. It’s a nice place for discussion, but hardly the place for actionable results. Good luck in your quest.
-
@Private-Confidential - I believe the most common reason for “lost files” is that someone reinstalls or updates Notepad++ and then posts the horror story titled “my files are gone!” Another common cause seems to be people working in enterprise environments and their roaming desktop profiles get mangled.
The enterprise issue is particularly challenging because people get randomly assigned virtual desktop sessions every they sign in. We can’t 100% depend on the contents of APPDATA, LOCALAPPDATA, or ProgramData being there tomorrow.
Thus, while your script is laudable it likely will not work in many “my files are gone!” situations as the script makes the assumption that the currently installed copy of Notepad++ exactly matches how Notepad++ was installed and configured yesterday or some vague time ago.