How could one avoid Notepad deleting the back ups of not saved txt files when they are closed and not saved?



  • How could one avoid Notepad deleting the back ups of not saved txt files when they are closed and not saved?

    Or at least let Notepad move them to the bin instead of deleting them completely.



  • @Cletos said in How could one avoid Notepad deleting the back ups of not saved txt files when they are closed and not saved?:

    Or at least let Notepad move them to the bin instead of deleting them completely.

    How can you move to the bin a “non-saved” file? It doesn’t exist, except as some text within a tab, and the Notepad++ backup system.

    Read the “Backup” section of the Notepad++ manual at:
    https://npp-user-manual.org/docs/preferences/
    it’s about halfway down.
    See my settings, I can have a non-saved file (there isn’t a real filename except in Notepad++ backup system), only “new 1”, “new 2” etc. I call these scratch files as I don’t really want a real file. At the end of typing and using it and want to remove it I can close the tab and select “no” to a save of the data. poof it disappears.
    e6fc7a29-cfa4-41f7-b3eb-5c9d12a48dd8-image.png

    Terry



  • @Terry-R said in How could one avoid Notepad deleting the back ups of not saved txt files when they are closed and not saved?:

    How can you move to the bin a “non-saved” file?

    May be the same way like Notepad back ups a file not being saved. But the backed up file is a saved file, so it exists.

    Thank you for the link and your settings. I almost have the same ones.

    Sorry, I do not understand. Is there a way to not let Notepad delete those back up files backed up of files not being saved?



  • @Cletos

    How could one avoid Notepad deleting the back ups of not saved txt files when they are closed and not saved?

    There is no setting which would allow this but you can try to changing
    the permissions for your configured backup directory to allow reads and writes but deny delete operations.
    But I have no idea how forgivable npp is for such a hack.



  • Yes, sounds like a good idea, thank you.



  • @Cletos

    How could one avoid Notepad deleting the back ups of not saved txt files when they are closed and not saved?

    Or at least let Notepad move them to the bin instead of deleting them completely.

    What is your end goal?
    If you give a file a real name in the file system, you can move it to the (recycle) “bin” and preserve the ability to get it back at some reasonable point.
    Seems to me to have the same affect as what you try to achieve, but with a “safer” mechanism?

    If it is a “hassle” to give the file a name/path by “making one up”, then a plugin or a Pythonscript can make creating “temporary” (but hard-named) files easy.

    But without knowing the end-goal, tough to give advice.
    Of course, maybe all you really want is the direct answer to your question – with no advice needed/wanted. :-)



  • @Alan-Kilborn said in How could one avoid Notepad deleting the back ups of not saved txt files when they are closed and not saved?:

    What is your end goal?

    I often make notices / note ideas only for lasting a short time in that file without saving the txt file. I want to avoid I by acciedent close that file (without saving) and lose information.

    If you give a file a real name in the file system, you can move it to the (recycle) “bin” and preserve the ability to get it back at some reasonable point.
    Seems to me to have the same affect as what you try to achieve, but with a “safer” mechanism?

    Yes, that is right, I would say, but I just want to do it with as less clicks / circumstances as possible.

    If it is a “hassle” to give the file a name/path by “making one up”, then a plugin or a Pythonscript can make creating “temporary” (but hard-named) files easy.

    Yes, that would be good, of course, to automatically get a named and saved file. E.g. when pressing CTRL+N a file opens, gets a name and is safed automatically.



  • @Cletos said

    automatically get a named and saved file. E.g. when pressing CTRL+N a file opens, gets a name and is safed automatically.

    The solution I use to this general situation is based on the Pythonscript presented HERE. I don’t use exactly that, but it is close enough.

    You can bind it to a keycombo (yes, Ctrl+n if you want that) or, you can do what I do and have it in the right-click context menu of the editor window.

    TIP: If you happened to want to save a new “non-temporary” file to the current file’s same folder (instead of a temp folder), and you’ve reassigned Ctrl+n, just do File > New, modify the document, and then save it. Default N++ behavior is then to open the Save As box in the folder of the file you were in last.



  • OK, that looks great, I will try that, thank you very much!


Log in to reply