(Tcl) Remove Directory
Delete a remote FTP directory.
load ./chilkat.dll
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set ftp [new_CkFtp2]
CkFtp2_put_Hostname $ftp "ftp.example.com"
CkFtp2_put_Username $ftp "login"
CkFtp2_put_Password $ftp "password"
# Connect and login to the FTP server.
set success [CkFtp2_Connect $ftp]
if {$success != 1} then {
puts [CkFtp2_lastErrorText $ftp]
delete_CkFtp2 $ftp
exit
}
# Delete a directory on the FTP server. The directory
# must not contain any files, otherwise an error status
# will be returned. Most FTP servers do not allow
# directories containing files to be deleted.
set success [CkFtp2_RemoveRemoteDir $ftp "newDirName"]
if {$success != 1} then {
puts [CkFtp2_lastErrorText $ftp]
delete_CkFtp2 $ftp
exit
}
set success [CkFtp2_Disconnect $ftp]
delete_CkFtp2 $ftp
|