Sample code for 30+ languages & platforms
PowerBuilder

Get FTP Server Features (FEAT)

See more FTP Examples

Demonstrates the Chilkat Ftp2.Feat method, which sends FEAT and returns the server's multiline capability reply. It takes no arguments.

Background: FEAT is how a client discovers which optional features a server supports — MLSD for machine-readable listings, UTF8 for Unicode filenames, SIZE, REST for resume, and the AUTH/PROT TLS commands. Chilkat normally runs FEAT automatically and adapts its behavior to the result, so calling it explicitly is mainly for inspection.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Ftp
string ls_Features

li_Success = 0

//  Demonstrates the Ftp2.Feat method, which sends FEAT and returns the server's multiline
//  capability reply.  It takes no arguments.

loo_Ftp = create oleobject
li_rc = loo_Ftp.ConnectToNewObject("Chilkat.Ftp2")
if li_rc < 0 then
    destroy loo_Ftp
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Ftp.Hostname = "ftp.example.com"
loo_Ftp.Username = "myFtpLogin"

//  Normally you would not hard-code the password in source.  You should instead obtain it
//  from an interactive prompt, environment variable, or a secrets vault.
loo_Ftp.Password = "myPassword"

//  Connect and log in (Connect performs both).
li_Success = loo_Ftp.Connect()
if li_Success = 0 then
    Write-Debug loo_Ftp.LastErrorText
    destroy loo_Ftp
    return
end if

//  The FEAT reply lists optional commands and features the server supports, such as MLSD, UTF8,
//  SIZE, and TLS-related capabilities.
ls_Features = loo_Ftp.Feat()
if loo_Ftp.LastMethodSuccess = 0 then
    Write-Debug loo_Ftp.LastErrorText
    destroy loo_Ftp
    return
end if

Write-Debug ls_Features

li_Success = loo_Ftp.Disconnect()
if li_Success = 0 then
    Write-Debug loo_Ftp.LastErrorText
    destroy loo_Ftp
    return
end if



destroy loo_Ftp