Multi Commander > Support and Feedback

MultiScript: CopyFile - How to copy to the same dir with the new name?

(1/2) > >>

Jungle:
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?

Ulfhednar:
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.   

Mathias (Author):

--- Quote from: 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?

--- End quote ---

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 ?

Jungle:

--- Quote from: Mathias (Author) on December 10, 2022, 15:04:23 ---So you mean if you set target name like  CopyFile ("C:\NewFile.txt" , C:\MyFile.txt" , "NODIALOG, OVERWRITE_ALL" );
It does not work ?
--- End quote ---


--- Code: ---# 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")
--- End code ---

Mathias (Author):

--- Code: ---@var $res = CopyFile("d:\\temp\\abc.txt", "d:\\temp\\1.txt", "NODIALOG")
--- End code ---
should work.. something must have broken.. I will investigate and see If I can fix that

Navigation

[0] Message Index

[#] Next page

Go to full version