Multi Commander Support Forum

Multi Commander => Support and Feedback => Topic started by: Jungle on December 08, 2022, 16:30:22

Title: MultiScript: CopyFile - How to copy to the same dir with the new name?
Post by: Jungle on December 08, 2022, 16:30:22
I want to copy some file to the same dir with a new name (manually specified, no autorename). But CopyFile function accepts only path as a target param.

Is it somehow possible to achieve the goal? If no, maybe enhance CopyFile with an additional param or implement a new function CloneFile?
Title: Re: MultiScript: CopyFile - How to copy to the same dir with the new name?
Post by: Ulfhednar on December 09, 2022, 16:17:54
You can click & drag/release in the same dir & it shows copy with new name as option on the dialog.  (Which you know :) )

Mathias probably needs to add this existing drag functionality to the MS command set, should be possible I hope.   

Title: Re: MultiScript: CopyFile - How to copy to the same dir with the new name?
Post by: Mathias (Author) on December 10, 2022, 15:04:23
I want to copy some file to the same dir with a new name (manually specified, no autorename). But CopyFile function accepts only path as a target param.

Is it somehow possible to achieve the goal? If no, maybe enhance CopyFile with an additional param or implement a new function CloneFile?

That should be able to do that is Script..
So you mean if you set target name like  CopyFile ("C:\NewFile.txt" , C:\MyFile.txt" , "NODIALOG, OVERWRITE_ALL" );
It does not work ?

Title: Re: MultiScript: CopyFile - How to copy to the same dir with the new name?
Post by: Jungle on December 10, 2022, 16:44:13
So you mean if you set target name like  CopyFile ("C:\NewFile.txt" , C:\MyFile.txt" , "NODIALOG, OVERWRITE_ALL" );
It does not work ?

Code: [Select]
# Error "Source and Target file are the same. Cannot copy a file to itself"
# (err.png)
@var $res = CopyFile("d:\\temp\\abc.txt", "d:\\temp\\1.txt", "NODIALOG")

# $res = 1, but file is not copied
$res = CopyFile("d:\temp\abc.txt", "d:\temp\1.txt", "NODIALOG")

# Shows copy dialog with wrong destination path (err2.png),
# but produce no error, file is not copied
$res = CopyFile("d:\temp\abc.txt", "d:\temp\1.txt")
Title: Re: MultiScript: CopyFile - How to copy to the same dir with the new name?
Post by: Mathias (Author) on December 10, 2022, 17:51:46
Code: [Select]
@var $res = CopyFile("d:\\temp\\abc.txt", "d:\\temp\\1.txt", "NODIALOG") should work.. something must have broken.. I will investigate and see If I can fix that
Title: Re: MultiScript: CopyFile - How to copy to the same dir with the new name?
Post by: AlanJB on December 10, 2022, 19:49:49
I can confirm the same failures in MC 11.6(build 2845).