Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    mass edit and preserve timestamp?

    Help wanted · · · – – – · · ·
    preserve edit timestamp
    2
    4
    686
    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.
    • Offerel
      Offerel last edited by

      I have handful of markdown files to edit and change in some of them the path to images. I know, i can do this with “Find in files” / Replace function. But i would like to ask if it is possible to preserve the timestamp of the files, because the original timestamp is important for a sync application. Is that possible and how can i do that?

      Meta Chuh 1 Reply Last reply Reply Quote 0
      • Meta Chuh
        Meta Chuh @Offerel last edited by

        welcome to the notepad++ community, @Offerel

        unfortunately notepad++ can not control the file modification time, and i currently know of no existing plugin that can inject data into files, without changing the time stamps.

        one thing you could do, is to use tools like BulkFileChanger to modify your timestamps after your replaces.
        you could also make a batch script to read and save all timestamps within a folder, make your changes, and restore the timestamps afterwards.

        note: BulkFileChanger is limited command line scriptable, but there are probably better file modification command line tools around, if you want to make a batch script for your needs.

        1 Reply Last reply Reply Quote 2
        • Offerel
          Offerel last edited by

          many thx for that suggestion. In the meantime i have written a short bash script to do the change on server side (Linux).
          I created a file edit.sh with the following content:

          for files in /media/mount/user/files/Notes/*.md
          do
              touch -r "$files" "dummy_file"
              sed -i 's/.\/media\//.\/.media\//g' "$files"
              touch -r "dummy_file" "$files"
          done
          

          Maybe its useful for others. What it odes is the following: it gets all *.md file in the above directory and replace “/media/” with “/.media/”. It uses sed for this. the backslash is only to escape the slash. If i find he time and need that function more, i try to find a better solution.

          Meta Chuh 1 Reply Last reply Reply Quote 3
          • Meta Chuh
            Meta Chuh @Offerel last edited by Meta Chuh

            @Offerel

            aaaaaaahh, nice idea to use dummy_file as a temporary timestamp reference file. 👍👍👍

            thanks for sharing 👍, i too think that it might come in handy for others.
            there are quite a few linux and mac users around here, including me.

            1 Reply Last reply Reply Quote 2
            • First post
              Last post
            Copyright © 2014 NodeBB Forums | Contributors