Author Topic: How to touch (copy only timestamps) of files to the other side?  (Read 11662 times)

pstein

  • Newbie
  • *
  • Posts: 9
    • View Profile
Assume I have two folders trees. The first on the left pane and the second on the right pane.
The content of all the files is the same but some of the files differ in their timestamp.

How can I mark e.g. 27 out of 231  files on the left pane and tell MC to copy (only) the timestamp of the corresponding file from the other side?

Thank you
Peter

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 536
  • Old Skull
    • View Profile
Re: How to touch (copy only timestamps) of files to the other side?
« Reply #1 on: March 27, 2019, 09:20:40 »
One of the ways is to use MultiScript. E.g. the following script changes destination files last write time to the one of the source files.
Code: [Select]
@var $src_path = GetSourcePath();
@var $dst_path = GetTargetPath();

if ( $src_path == $dst_path )
{
  return -1;
}

@var $src_sel = GetSourceSelectedFileNames();
@var $n;
@var $src_file;
@var $dst_file;
@var $time;

for ( $n = 0; $n < arrayCount( $src_sel ); $n++ )
{
  $src_file = $src_path ^ $src_sel[ $n ];
  if ( IsFolder( $src_file ) )
  {
    continue;
  }

  $dst_file = $dst_path ^ $src_sel[ $n ];

  if ( FileExists( $dst_file ) )
  {
    $time = GetFileTime( $src_file );
    SetFileTime( $dst_file, $time );
  }
}
But this script works for manually selected files within two folders. It's not much harder to automatically find all mismatching files as long as two folders are compared. But if you want to sync whole folders structure it would require [significantly] more work.
« Last Edit: March 27, 2019, 10:06:40 by Jungle »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4411
    • View Profile
    • Multi Commander
Re: How to touch (copy only timestamps) of files to the other side?
« Reply #2 on: April 03, 2019, 13:05:53 »
In the Edit menu you got many Compare and select functions.. and you also have a advanced option .
In the advanced you can compare by time.