Tapatalk

Replace in Files with keeping original last modification date/time

Replace in Files with keeping original last modification date/time

4
NewbieNewbie
4

    Jul 04, 2013#1

    Hello to all,

    if using function 'Replace in Files' I am wondering if keeping original date/time of last modification is possible?

    Any hint about that?

    Thanks, best regards!

    6,685587
    Grand MasterGrand Master
    6,685587

      Jul 06, 2013#2

      UltraEdit has no option to get current last modification date of a file, make changes in the file, and finally set the last modification date back to the previous last modification date.

      4
      NewbieNewbie
      4

        Jul 07, 2013#3

        Thanks for reply.
        Maybe this can be included in future releases?

          Jul 09, 2013#4

          Hello to all,

          I sent the feature request to IDM support.

          However, if using function 'Replace in Files' keeping original date/time by option isn't possible so far, would it be possible with a script action like:

          open file from disk
          check and save original date/time
          find and replace *somewhat*
          save modified file to disk
          set date/time to original date/time


          Any chance doing this by a script?

          Thanks, best regards!

          6,685587
          Grand MasterGrand Master
          6,685587

            Jul 09, 2013#5

            There are no scripting commands to get and set file times. Such functions are always OS dependent and therefore not included in multi-os scripting languages.

            What you need is a tool which uses GetFileTime and SetFileTime C++ functions.

            There are lots of tools supporting setting the creation, last modification and last access date/time of files. My favorite file manager Total Commander also supports changing the last modification date on files and even directories. But I have not yet found any tool which first gets all the file dates of a single file or a list of files, then let the user make modifications on the file(s) with any application, and next on user request sets the file date back after the modifications to the date read before.

            4
            NewbieNewbie
            4

              Jul 10, 2013#6

              Thanks, maybe Autohotkey can do it for us!?
              I'll check it in AHK forum...

              6,685587
              Grand MasterGrand Master
              6,685587

                May 25, 2014#7

                I found a solution for this task using the file manager Total Commander and UltraEdit.
                1. Before making the changes on the files, it is necessary to create a copy of the files to modify in another directory. Best would be most likely to copy the entire directory (tree) which can be done with Total Commander using key F5 or the button Copy.
                2. Modify now the files with UltraEdit, for example by using the Replace in Files command.
                3. Now in Total Commander, open Synchronize Dirs from menu Commands.
                4. If the directory with the modified files and the directory with the original files are not already selected, use the buttons >> at top to browse to those 2 directories.
                5. Enable the option Subdirs if files in subdirectories were modified, too.
                6. Click on the button with the equal sign to uncheck this option as files not modified are of no interest.
                7. Run the directory compare using button Compare. A list of files is displayed with green or blue arrow between the file names depending on which side are the original files and on which side are the modified files.
                8. Press Ctrl+A to select all of them and press Shift+F10 or click with right mouse button on the list to open the context menu.
                9. Execute now the Copy file properties context menu item which is the right one depending on which side the original files are.
                10. One more dialog opens giving the user the choice which file attributes to copy. Enable at least Timestamp (date+time) and click on button OK.
                11. The modified files now either disappear from the list (equal size) or are displayed now with not equal symbol because of identical file date, but different file size. Close the synchronize directories window with button Close or key ESC.
                12. The last step is to delete now the directory with the original files as no longer needed.
                Best regards from an UC/UE/UES for Windows user from Austria