[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ftp_quote not working
hi Craig,
In an FTP client, the "QUOTE" subcommand is used to send raw FTP
protocol data from the client to the server.
When you log in "by hand" (as you put it) you are NOT using quote at
all. You are simply typing the commands that you want to run into the
client, and it is interpreting them and running them. So all is well.
You've told FTPAPI to send 'ls audit* (disk' to the FTP server as if
it's FTP protocol data. It is not. The FTP protocol has no notion of
an 'ls' command.
In the IBM FTP client for i. (Which is what you've termed doing it "by
hand") you type "ls audit* (disk", and that is NOT sent to the server as
is. Instead, the FTP client reads it. It knows what "ls" means, so it
sends the "NLST" FTP command. The (DISK part is not part of the FTP
protocol at all, but rather is an instruction to the IBM FTP client (and
is peculiar -- a feature that doesn't exist in any other FTP client I've
ever heard of -- at least, not with that syntax.) Furthermore, because
the client understood and interpreted your command, it sets up the data
connection to transfer the directory listing for you. That's something
else that would not happen if you sent the raw FTP protocol yourself.
To compare apples to apples, go into the IBM FTP client (i.e. "by hand")
and try the following command:
QUOTE 'ls audit* (disk'
(That is, after all, exactly what you told FTPAPI to do.)
Anyway, FTPAPI is a programmatic interface. It doesn't know how to write
a directory to disk. It has the option to return a directory listing
straight to your program (in an array) or to use a callback subprocedure
to send the file names one at a time. If you wanted it written to disk,
you could easily write code to do that, since the RPG programming
language has a rich array of options for writing data to disk :)
On 10/17/2011 10:15 AM, Craig Jacobsen wrote:
>
> I am trying to create a list of all audit files on an FTP server.
>
> I may have thousands of entries (begin with AUDIT or BATCH) and am
> going to use the output file to compare against a file of already
> ftp'd files and ftp files not already there.
>
>
> If I log on by hand, everything works ok:
>
>
> Connecting to remote host 172.17.1.21 using port 5008.
>
> 220 FileZilla Server version 0.9.24 beta
>
> trails_client
>
> 331 Password required for trails_client
>
> 230 Logged on
>
> UNIX emulated by FileZilla
>
> sendepsv
>
> SENDEPSV is off.
>
> ls audit* (disk
>
> 227 Entering Passive Mode (172,17,1,21,17,89)
>
> 150 Connection accepted
>
> 226 Transfer OK
>
>
> I connect to the ftp server ok with FTPAPI but keep getting a syntax
> error through ftp_quote
>
>
> // connect to the line 1 ftp server
>
> ftp = ftp_conn('172.17.1.21':'trails_client':'password':5008);
>
>
> // set the passive mode *off
>
> ReturnCode = Ftp_PassiveMode(ftp:*Off);
>
>
> // create lsoutput file with all audit files
>
> ReturnCode = Ftp_Quote(ftp:'ls audit* (disk');
>
>
> Joblog says:
>
> > ls audit* (disk
>
> 500 Syntax error, command unrecognized.
>
>
> Why is this a syntax error? I'm probably doing something wrong, but I
> can't figure it out.
>
>
> Thanks in advance for any help,
>
>
> Craig
>
> Confidentiality Notice: This e-mail message, including any
> attachments, is for the sole use of the intended recipient(s) and may
> contain confidential and privileged information. Any unauthorized
> review, use, disclosure or distribution is prohibited. If you are not
> the intended recipient, please contact the sender by reply e-mail and
> destroy all copies of the original message. Unless expressly stated in
> this e-mail, nothing in this message or any attachment should be
> construed as a digital or electronic signature.
>
>
>
>
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list. To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------