mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: FTP - copy files between remote directories (SSH)
This commit is contained in:
parent
66bc5720c5
commit
8883b6936a
3 changed files with 26 additions and 0 deletions
|
|
@ -124,6 +124,7 @@ type
|
|||
function FileExists(const FileName: String): Boolean; virtual;
|
||||
function CreateDir(const Directory: string): Boolean; override;
|
||||
function ExecuteCommand(const Command: String): Boolean; virtual;
|
||||
function CopyFile(const OldName, NewName: String): Boolean; virtual;
|
||||
function ChangeMode(const FileName, Mode: String): Boolean; virtual;
|
||||
function List(Directory: String; NameList: Boolean): Boolean; override;
|
||||
function StoreFile(const FileName: string; Restore: Boolean): Boolean; override;
|
||||
|
|
@ -789,6 +790,11 @@ begin
|
|||
Result:= (FTPCommand(Command) div 100) = 2;
|
||||
end;
|
||||
|
||||
function TFTPSendEx.CopyFile(const OldName, NewName: String): Boolean;
|
||||
begin
|
||||
Result:= False;
|
||||
end;
|
||||
|
||||
function TFTPSendEx.ChangeMode(const FileName, Mode: String): Boolean;
|
||||
begin
|
||||
Result:= (FTPCommand('SITE CHMOD' + #32 + Mode + #32 + FileName) div 100) = 2;
|
||||
|
|
|
|||
|
|
@ -820,6 +820,20 @@ begin
|
|||
WriteConnectionList;
|
||||
Result:= FS_FILE_OK;
|
||||
end;
|
||||
end
|
||||
else if GetConnectionByPath(OldName, FtpSend, sOldName) then
|
||||
begin
|
||||
if FtpSend is TScpSend then
|
||||
begin
|
||||
sNewName := FtpSend.ClientToServer(NewName);
|
||||
sNewName := ExtractRemoteFileName(sNewName);
|
||||
ProgressProc(PluginNumber, OldName, NewName, 0);
|
||||
if FtpSend.CopyFile(sOldName, sNewName) then
|
||||
begin
|
||||
ProgressProc(PluginNumber, OldName, NewName, 100);
|
||||
Result := FS_FILE_OK;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Exit;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ type
|
|||
function DeleteDir(const Directory: string): Boolean; override;
|
||||
function DeleteFile(const FileName: string): Boolean; override;
|
||||
function ExecuteCommand(const Command: String): Boolean; override;
|
||||
function CopyFile(const OldName, NewName: String): Boolean; override;
|
||||
function ChangeWorkingDir(const Directory: string): Boolean; override;
|
||||
function RenameFile(const OldName, NewName: string): Boolean; override;
|
||||
function ChangeMode(const FileName, Mode: String): Boolean; override;
|
||||
|
|
@ -671,6 +672,11 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function TScpSend.CopyFile(const OldName, NewName: String): Boolean;
|
||||
begin
|
||||
Result:= SendCommand('cp -p ' + EscapeNoQuotes(OldName) + ' ' + EscapeNoQuotes(NewName), FAnswer);
|
||||
end;
|
||||
|
||||
function TScpSend.ChangeWorkingDir(const Directory: string): Boolean;
|
||||
begin
|
||||
Result:= SendCommand('cd ' + EscapeNoQuotes(Directory), FAnswer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue