Multi Commander Support Forum

Multi Commander => Support and Feedback => Topic started by: pstein on March 25, 2019, 10:15:55

Title: How to touch (copy only timestamps) of files to the other side?
Post by: pstein on March 25, 2019, 10:15:55
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
Title: Re: How to touch (copy only timestamps) of files to the other side?
Post by: Jungle 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.
Title: Re: How to touch (copy only timestamps) of files to the other side?
Post by: Mathias (Author) 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.