Tcl
Tcl
Provide an FTP ACCT Account Identifier
See more FTP Examples
Demonstrates the Account property, which supplies the value for the FTP ACCT command sent after USER/PASS when a server requests it.
Background:
ACCT is a vestige of early FTP, where an account identifier could be required in addition to the username and password — think mainframe billing codes or storage-group selection. It is very rarely needed today; almost every modern server authenticates with USER and PASS alone. Set this only when connecting to a legacy host that explicitly asks for account information after login.Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
set ftp [new_CkFtp2]
CkFtp2_put_Hostname $ftp "ftp.example.com"
CkFtp2_put_Username $ftp "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.
CkFtp2_put_Password $ftp "myPassword"
# Account supplies the value for the FTP ACCT command, sent after USER/PASS when a server
# requests it. This is very rarely needed today -- almost all modern servers use only USER and
# PASS -- but some legacy hosts require an additional account identifier.
CkFtp2_put_Account $ftp "myAccountId"
set success [CkFtp2_Connect $ftp]
if {$success == 0} then {
puts [CkFtp2_lastErrorText $ftp]
delete_CkFtp2 $ftp
exit
}
puts "Logged in (ACCT provided if the server requested it)."
set success [CkFtp2_Disconnect $ftp]
if {$success == 0} then {
puts [CkFtp2_lastErrorText $ftp]
delete_CkFtp2 $ftp
exit
}
delete_CkFtp2 $ftp