(Unicode C) Remove Directory
Delete a remote FTP directory.
#include <C_CkFtp2W.h>
void ChilkatSample(void)
{
HCkFtp2W ftp;
BOOL success;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
ftp = CkFtp2W_Create();
CkFtp2W_putHostname(ftp,L"ftp.example.com");
CkFtp2W_putUsername(ftp,L"login");
CkFtp2W_putPassword(ftp,L"password");
// Connect and login to the FTP server.
success = CkFtp2W_Connect(ftp);
if (success != TRUE) {
wprintf(L"%s\n",CkFtp2W_lastErrorText(ftp));
CkFtp2W_Dispose(ftp);
return;
}
// 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.
success = CkFtp2W_RemoveRemoteDir(ftp,L"newDirName");
if (success != TRUE) {
wprintf(L"%s\n",CkFtp2W_lastErrorText(ftp));
CkFtp2W_Dispose(ftp);
return;
}
success = CkFtp2W_Disconnect(ftp);
CkFtp2W_Dispose(ftp);
}
|