Community
    • Login

    Shrinking file size to the new smaller contents on exit

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    file size
    4 Posts 2 Posters 3.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Lee RothsteinL
      Lee Rothstein
      last edited by

      I have a number of bash and perl scripts that depend on the size of a file after an editing session. What I’ve seen from npp (Notepad++), is that if you just close the editor, it will write the file, but it doesn’t shrink the size of the file to the new smaller size.

      If, however, you hit ^-S to save before you exit, it will shrink the file size to a new smaller size.

      Is there any way to change the default to the latter operation?

      TIA,

      Lee

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Lee Rothstein
        last edited by

        Hello Lee,

        I guess you are talking about the session snapshot and periodic backup functionality.
        Can be found under settings->preferences->backup.
        But this would mean, that npp hasn’t really updated the file itself instead of the backup it has created.
        When disabling the mentioned session… you will be asked to save modified files before npp shuts down.
        Or did I miss something?

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • Lee RothsteinL
          Lee Rothstein
          last edited by

          It is updating the file, in that the content is gone on next edit, or run (if a script), but the file size does not change!

          1 Reply Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank
            last edited by

            I still think this is related to the session snapshot and periodic backup functionality.
            A few questions

            I have a number of bash and perl scripts that depend on the size of a file after an editing session

            What means editing session? You edited the file or the bash/perl scripts?

            What I’ve seen from npp (Notepad++), is that if you just close the editor, it will write the file, but it doesn’t shrink the size of the file to the new smaller size.

            As said, this sounds like snapshot and periodic backup functionality is ative, because otherwise
            npp would ask you whether to save any of the modified files. Is this the case? Does npp
            ask you to save the files if you close the editor?

            It is updating the file, in that the content is gone on next edit, or run (if a script), but the file size does not change!

            How do you check that the file size didn’t change? Did you try to open that file with a different
            editor, preferable a hex editor? Is it still empty?

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors