[Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

General discussion related to "Everything".
Post Reply
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

[Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by raccoon »

I've got two folders (on two different disks) with identical contents in each. One folder has correct timestamps on each file and folder. The second folder has incorrect timestamps. Does anyone know of a program or script that can help me synchronize (transplant) the correct date-modified and date-created timestamps from one collection onto the other collection?
Last edited by raccoon on Sat Mar 19, 2022 11:21 pm, edited 1 time in total.
horst.epp
Posts: 1447
Joined: Fri Apr 04, 2014 3:24 pm

Re: Help synchronizing file and folder date-modified and date-created times

Post by horst.epp »

This one does it
robocopy /e /timfix /dcopy:t /copy:t c:\source d:\destination
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Help synchronizing file and folder date-modified and date-created times

Post by raccoon »

Wow, thanks! I knew that ROBOCOPY had attracted a group of enthusiast developers but I had no idea they made such extensive additions!
harryray2
Posts: 1104
Joined: Sat Oct 15, 2016 9:56 am

Re: Help synchronizing file and folder date-modified and date-created times

Post by harryray2 »

racoon, If it's at all useful to you, there's also a frontend for Robocopy.
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

ROBOCOPY (was: Help synchronizing file and folder date-modified and date-created times)

Post by raccoon »

Thanks harry. I'm satisfied with the commandline options. I'll copy them here for reference and searchability.

Code: Select all

# transpose timestamps from one copy to a mirror copy with messed up dates:
robocopy /e /timfix /dcopy:t /copy:t c:\source d:\destination


-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Sat Mar 19 16:54:24 2022

       Simple Usage :: ROBOCOPY source destination /MIR

             source :: Source Directory (drive:\path or \\server\share\path).
        destination :: Destination Dir  (drive:\path or \\server\share\path).
               /MIR :: Mirror a complete directory tree.

    For more usage information run ROBOCOPY /?

                                                          
****  /MIR can DELETE files as well as copy them !

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Sat Mar 19 16:54:37 2022

              Usage :: ROBOCOPY source destination [file [file]...] [options]

             source :: Source Directory (drive:\path or \\server\share\path).
        destination :: Destination Dir  (drive:\path or \\server\share\path).
               file :: File(s) to copy  (names/wildcards: default is "*.*").

::
:: Copy options :
::
                 /S :: copy Subdirectories, but not empty ones.
                 /E :: copy subdirectories, including Empty ones.
             /LEV:n :: only copy the top n LEVels of the source directory tree.

                 /Z :: copy files in restartable mode.
                 /B :: copy files in Backup mode.
                /ZB :: use restartable mode; if access denied use Backup mode.
            /EFSRAW :: copy all encrypted files in EFS RAW mode.

  /COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
                       (copyflags : D=Data, A=Attributes, T=Timestamps).
                       (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).

 
               /SEC :: copy files with SECurity (equivalent to /COPY:DATS).
           /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
            /NOCOPY :: COPY NO file info (useful with /PURGE).
            /SECFIX :: FIX file SECurity on all files, even skipped files.
            /TIMFIX :: FIX file TIMes on all files, even skipped files.

             /PURGE :: delete dest files/dirs that no longer exist in source.
               /MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).

               /MOV :: MOVe files (delete from source after copying).
              /MOVE :: MOVE files AND dirs (delete from source after copying).

     /A+:[RASHCNET] :: add the given Attributes to copied files.
     /A-:[RASHCNET] :: remove the given Attributes from copied files.

            /CREATE :: CREATE directory tree and zero-length files only.
               /FAT :: create destination files using 8.3 FAT file names only.
               /256 :: turn off very long path (> 256 characters) support.

             /MON:n :: MONitor source; run again when more than n changes seen.
             /MOT:m :: MOnitor source; run again in m minutes Time, if changed.

      /RH:hhmm-hhmm :: Run Hours - times when new copies may be started.
                /PF :: check run hours on a Per File (not per pass) basis.

             /IPG:n :: Inter-Packet Gap (ms), to free bandwidth on slow lines.

                /SL :: copy symbolic links versus the target.

            /MT[:n] :: Do multi-threaded copies with n threads (default 8).
                       n must be at least 1 and not greater than 128.
                       This option is incompatible with the /IPG and /EFSRAW options.
                       Redirect output using /LOG option for better performance.

 /DCOPY:copyflag[s] :: what to COPY for directories (default is /DCOPY:DA).
                       (copyflags : D=Data, A=Attributes, T=Timestamps).

           /NODCOPY :: COPY NO directory info (by default /DCOPY:DA is done).

::
:: File Selection Options :
::
                 /A :: copy only files with the Archive attribute set.
                 /M :: copy only files with the Archive attribute and reset it.
    /IA:[RASHCNETO] :: Include only files with any of the given Attributes set.
    /XA:[RASHCNETO] :: eXclude files with any of the given Attributes set.

 /XF file [file]... :: eXclude Files matching given names/paths/wildcards.
 /XD dirs [dirs]... :: eXclude Directories matching given names/paths.

                /XC :: eXclude Changed files.
                /XN :: eXclude Newer files.
                /XO :: eXclude Older files.
                /XX :: eXclude eXtra files and directories.
                /XL :: eXclude Lonely files and directories.
                /IS :: Include Same files.
                /IT :: Include Tweaked files.

             /MAX:n :: MAXimum file size - exclude files bigger than n bytes.
             /MIN:n :: MINimum file size - exclude files smaller than n bytes.

          /MAXAGE:n :: MAXimum file AGE - exclude files older than n days/date.
          /MINAGE:n :: MINimum file AGE - exclude files newer than n days/date.
          /MAXLAD:n :: MAXimum Last Access Date - exclude files unused since n.
          /MINLAD:n :: MINimum Last Access Date - exclude files used since n.
                       (If n < 1900 then n = n days, else n = YYYYMMDD date).

                /XJ :: eXclude Junction points. (normally included by default).

               /FFT :: assume FAT File Times (2-second granularity).
               /DST :: compensate for one-hour DST time differences.

               /XJD :: eXclude Junction points for Directories.
               /XJF :: eXclude Junction points for Files.

::
:: Retry Options :
::
               /R:n :: number of Retries on failed copies: default 1 million.
               /W:n :: Wait time between retries: default is 30 seconds.

               /REG :: Save /R:n and /W:n in the Registry as default settings.

               /TBD :: wait for sharenames To Be Defined (retry error 67).

::
:: Logging Options :
::
                 /L :: List only - don't copy, timestamp or delete any files.
                 /X :: report all eXtra files, not just those selected.
                 /V :: produce Verbose output, showing skipped files.
                /TS :: include source file Time Stamps in the output.
                /FP :: include Full Pathname of files in the output.
             /BYTES :: Print sizes as bytes.

                /NS :: No Size - don't log file sizes.
                /NC :: No Class - don't log file classes.
               /NFL :: No File List - don't log file names.
               /NDL :: No Directory List - don't log directory names.

                /NP :: No Progress - don't display percentage copied.
               /ETA :: show Estimated Time of Arrival of copied files.

          /LOG:file :: output status to LOG file (overwrite existing log).
         /LOG+:file :: output status to LOG file (append to existing log).

       /UNILOG:file :: output status to LOG file as UNICODE (overwrite existing log).
      /UNILOG+:file :: output status to LOG file as UNICODE (append to existing log).

               /TEE :: output to console window, as well as the log file.

               /NJH :: No Job Header.
               /NJS :: No Job Summary.

           /UNICODE :: output status as UNICODE.

::
:: Job Options :
::
       /JOB:jobname :: take parameters from the named JOB file.
      /SAVE:jobname :: SAVE parameters to the named job file
              /QUIT :: QUIT after processing command line (to view parameters). 
              /NOSD :: NO Source Directory is specified.
              /NODD :: NO Destination Directory is specified.
                /IF :: Include the following Files.
therube
Posts: 4977
Joined: Thu Sep 03, 2009 6:48 pm

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by therube »

GUI method, (nirsoft's) FolderTimeUpdate "is a simple tool for Windows that scans all files and folders under the base folder you choose, and updates the 'Modified Time' of every folder according the latest modified time of the files stored in it.

This tool might be useful if, for example, you backup a cluster of folders and then restore them into another disk, but the backup program doesn't restore the original modified time of the folders."


(This method could end up different, as it is dealing with the dates of files found within the directories, where robocopy is setting destination dates based upon the source file/dir dates.)
horst.epp
Posts: 1447
Joined: Fri Apr 04, 2014 3:24 pm

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by horst.epp »

I always use FolderTimeUpdate to set my Picture folders to the newest picture date
after I updated some of the pictures inside.
Its a very useful tool.
therube
Posts: 4977
Joined: Thu Sep 03, 2009 6:48 pm

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by therube »

(
On the chance that this is FastCopy related:
v4.1.3
Fixed a bug in Win8.1 or earlier where timestamps were not retained when adding verification information.
)
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by raccoon »

therube wrote: Mon Mar 21, 2022 4:05 pm On the chance that this is FastCopy related...
Indeed. Thanks. I'm currently exploring for a copy alternative that also supports computing a file's hash during copy and marking it down to a digest (sidecar) file or ADS data. Shame ROBOCOPY has no such option.

Glad he was able to find the bug after setting aside his nobility.
horst.epp
Posts: 1447
Joined: Fri Apr 04, 2014 3:24 pm

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by horst.epp »

After some time using FastCopy I found TeraCopy better.
TeraCopy (3.8.5) has all the necessary options
and can also store the checksum file after verification.
Screenshot - 21.03.2022 , 19_51_35.png
Screenshot - 21.03.2022 , 19_51_35.png (14.56 KiB) Viewed 27557 times
therube
Posts: 4977
Joined: Thu Sep 03, 2009 6:48 pm

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by therube »

(I found TeraCopy to be "awkward" - for my style of doing things.
FastCopy has a context-menu entry (option) & further, pasting entries (from Everything ;-)) is painless.)

(See also, viewtopic.php?p=44348#p44348 [which I actually wrote up some time ago, just getting to "post".])
horst.epp
Posts: 1447
Joined: Fri Apr 04, 2014 3:24 pm

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by horst.epp »

therube wrote: Mon Mar 21, 2022 7:04 pm (I found TeraCopy to be "awkward" - for my style of doing things.
FastCopy has a context-menu entry (option) & further, pasting entries (from Everything ;-)) is painless.)

(See also, viewtopic.php?p=44348#p44348 [which I actually wrote up some time ago, just getting to "post".])
TeraCopy also has a context menu entry.

Pasting items (files or dirs) from Everything works here without problems.
For the target it even shows the current folder in file manager (Total Commander).

It supports lists with selected files from TC to move or copy using a button.
This also can be done with FastCopy, but the handling of collisions is much better in TeraCopy.
Last edited by horst.epp on Mon Mar 21, 2022 9:11 pm, edited 2 times in total.
harryray2
Posts: 1104
Joined: Sat Oct 15, 2016 9:56 am

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by harryray2 »

I've been using Teracopy for a number of years and found it to be great...very simple drag and drop with the context menu and very good verification and collision options. It integrates nicely into Windows, with the option to replace the native Windows copy and move (or to have both available)

I tried Fastcopy and found it way too "clunky"
Attachments
tera2.jpg
tera2.jpg (34.52 KiB) Viewed 27536 times
tera3.jpg
tera3.jpg (8.72 KiB) Viewed 27536 times
tera.jpg
tera.jpg (44.56 KiB) Viewed 27536 times
horst.epp
Posts: 1447
Joined: Fri Apr 04, 2014 3:24 pm

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by horst.epp »

2harryray2
For your info, its now version 3.9
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by raccoon »

harryray2 wrote: Mon Mar 21, 2022 7:39 pm I tried Fastcopy and found it way too "clunky"
I don't understand what "clunky" means. From these screenshots, TeraCopy looks like a gigantic child's Speak 'n Spell, and FastCopy looks like a tiny sleek Casio wristwatch. TeraCopy looks clunky by aesthetic standards.
horst.epp
Posts: 1447
Joined: Fri Apr 04, 2014 3:24 pm

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by horst.epp »

raccoon wrote: Mon Mar 21, 2022 9:15 pm
harryray2 wrote: Mon Mar 21, 2022 7:39 pm I tried Fastcopy and found it way too "clunky"
I don't understand what "clunky" means. From these screenshots, TeraCopy looks like a gigantic child's Speak 'n Spell, and FastCopy looks like a tiny sleek Casio wristwatch. TeraCopy looks clunky by aesthetic standards.
The GUI is old fashioned but it has some options which are not found on other such tools.
Also you see this GUI only after collisions.
Using the provided Explorer, Total Commander and XYPlorer integration
makes it perfect for me and many other users.
Its also has the benefit that the full functionality is free for home users.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: [Solved with ROBOCOPY] Help synchronizing file and folder date-modified and date-created times

Post by NotNull »

horst.epp wrote: Tue Mar 22, 2022 1:44 pm The GUI is old fashioned but it has some options which are not found on other such tools.
Also you see this GUI only after collisions.
Using the provided Explorer, Total Commander and XYPlorer integration
makes it perfect for me and many other users.
Its also has the benefit that the full functionality is free for home users.
"it" = FastCopy or "it" = TeraCopy?

(sorry, I lost track in which 'camp' you are )

EDIT: Never mind:
After some time using FastCopy I found TeraCopy better.
Post Reply