• Login
Community
  • Login

Edit file but keeping modified date

Scheduled Pinned Locked Moved General Discussion
7 Posts 3 Posters 4.1k 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.
  • R
    Rodrigo Hernandez 0
    last edited by Jul 12, 2021, 4:08 AM

    Sometimes,
    I need to keep modified date of file, but
    I want to add additional information, example
    about any meeting, I try remember ideas
    to include in the existent file.

    New Feature:

    Menu:
    File > Save keeping modified date

    thanks in advance!

    P 1 Reply Last reply Jul 12, 2021, 1:07 PM Reply Quote 0
    • P
      PeterJones @Rodrigo Hernandez 0
      last edited by Jul 12, 2021, 1:07 PM

      @Rodrigo-Hernandez-0 said in Edit file but keeping modified date:

      I need to keep modified date of file, but
      I want to add additional information, example

      That’s not the way Windows NTFS (the filesystem favored by Windows OS) works – nor any of the unix/linux filesystems I’ve used.

      “Last Modified”, to the OS, means the date and time that the file was most recently changed. Adding additional information inside the file is, by definition, modifying the file, so the last-modified date is changed. The last-modified attribute is controlled by the OS, not by the individual applications that are asking for the file contents to be saved.

      1 Reply Last reply Reply Quote 1
      • R
        Rodrigo Hernandez 0
        last edited by Jul 12, 2021, 7:09 PM

        The idea is useful, when is simplify the task additional: modifiying date manually after save the edited file.
        For me is useful when you have a big list of files ordered by modified date,
        to keep ordered list.

        P 1 Reply Last reply Jul 12, 2021, 7:54 PM Reply Quote 0
        • P
          PeterJones @Rodrigo Hernandez 0
          last edited by Jul 12, 2021, 7:54 PM

          @Rodrigo-Hernandez-0 ,

          I didn’t say it wasn’t useful. I just said it’s not the way that Windows works by default

          Changing the filesystem’s last-modified date is not something that Notepad++ does, or should be expected to do; Notepad++ just asks the operating system (OS) to save the file to the filesystem, and the OS takes care of adding the last-modified timestamp to the filesystem metadata for that file when the modification is over. Notepad++ doesn’t edit filesystem metadata, and leaves it up to the OS to properly handle filestamps. Asking Notepad++ to edit last-modified time from reality to a made-up value is asking it to be something other than a text editor.

          There are external tools that can change the last-modified date, akin to linux’s touch command … in fact, if you search for “windows touch command”, you can find a port of touch compiled as touch.exe (for example here , though that’s a pretty old version). If you need help with touch.exe or other similar utilities designed specifically for Windows OS, you will have to find support elsewhere, because those aren’t what Notepad++ does.

          Once you have such an external utility working, you could use Notepad++'s Run menu to run it, and even save it as a command that you could apply a keyboard shortcut to… but Notepad++ itself isn’t going to have the code to change the last-modified time. Or you could use a scripting plugin like the NppExec or PythonScript to make a really fancy wrapper that will ask you for the “fake” time and then run the external utility to set the “last modified” time. Or a scripting plugin could also be used to grab the existing last-modified time, then tell Notepad++ to save, then use the external utility to change the last-modified time to the grabbed value instead of the real value.

          But, really, if you want to be able to easily order files by some “fixed” time, that doesn’t get changed by modifying the file, then just put a yyyymmddhhmmss timestamp as the prefix to the filename, and sort by filename, and don’t try to mess with filesystem/os timestamps.

          1 Reply Last reply Reply Quote 2
          • M
            mere-human
            last edited by Jul 12, 2021, 8:50 PM

            I usually use Double Commander for such task. It has a feature to modify file attributes.
            aa820463-c078-4131-8f79-05b229881623-image.png
            But honestly, I rarely need it. The only case for me was when I had some old photos from camera with the wrong date. So I had to set the right date manually.

            Why do you need such feature? Do you want to sort by date?

            R 1 Reply Last reply Jul 12, 2021, 10:59 PM Reply Quote 1
            • R
              Rodrigo Hernandez 0 @mere-human
              last edited by Jul 12, 2021, 10:59 PM

              @mere-human
              I usually view files as historical records of my notes, meetings, etc.
              maybe interesting this new feature or new plugin

              In a simple idea: improve the productivity

              thanks in advance.

              M 1 Reply Last reply Jul 16, 2021, 6:18 AM Reply Quote 0
              • M
                mere-human @Rodrigo Hernandez 0
                last edited by Jul 16, 2021, 6:18 AM

                @Rodrigo-Hernandez-0 said in Edit file but keeping modified date:

                I usually view files as historical records of my notes, meetings, etc.

                I could only suggest sorting by “modified time” or adding a date to the file name.
                That would be much easier, as for me.
                0feaa20a-df73-40db-803e-498abaf00187-image.png

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