Page 1 of 1

TScSFTPClient rename flags not working

Posted: Fri 24 Jun 2022 10:36
by RobinP
Hi, I'm using the TScSFTPClient component with C++ Builder. The rename operation fails if the target file already exists even if I pass the rfOverwrite flag. My code is below, am I missing something? Thx.

Code: Select all

        if (!ScSFTPClient->Active)
            ScSFTPClient->Initialize();
        TScSFTPRenameFlags flags;
        if (overwrite)
            flags << rfOverwrite;
        else
            flags >> rfOverwrite;
        ScSFTPClient->RenameFile(src_path, dst_path, flags);

Re: TScSFTPClient rename flags not working

Posted: Thu 30 Jun 2022 10:10
by Dimon
Hi there,

Please provide us with the exact error message you are getting. There is a chance that this behavior is related to SFTP server settings. Please check if it is possible to perform this operation using any third-party tools (e.g. Putty).

Re: TScSFTPClient rename flags not working

Posted: Thu 30 Jun 2022 12:21
by RobinP
Hi, thanks for your answer looks like you may be right, I tried with FileZilla and even though it prompted me to overwrite the rename failed.
The error message I get is just code 4 "Failure".

I've worked around it for now by always deleting the destination file first.

Re: TScSFTPClient rename flags not working

Posted: Wed 06 Jul 2022 08:17
by Dimon
If there is anything else I can help you with, please contact me.