Search code examples
ftpibm-midrange

FTP Quote command using CFTPClient library


By searching on internet for Quote command did not find much.

I am using CFTPClient library from
http://www.codeproject.com/Articles/8667/FTP-Client-Class

How to send QUOTE command after copying a file to FTP?

Quote rcmd sbmjob cmd(call pgm...

Any pointer will be appreciated.


Solution

  • There's no QUOTE command in FTP protocol.

    The quote is a common command in many command-line FTP clients (like the Windows ftp.exe or the Linux ftp) that sends an arbitrary FTP protocol command to the FTP server.

    So the actual protocol command you want to send to the FTP server is RCMD. (Though note that RCMD is not a standard FTP protocol command, it seems to be a server-specific command of IBM AS/400 FTP server).

    The CFTPClient does not support the RCMD, nor it seems to support sending an arbitrary command to the server (what is otherwise common in FTP client libraries).

    But if you take a look at the implementation of the CFTPClient::SendCommand, you will see how to implement it on your own.

    It would be like:

    m_apSckControlConnection->Write("RCMD sbmjob ...", length, ...);
    CReply reply;
    GetResponse(reply);