ftp_folders

 execute ibeblock(
    HostName variant,
    UserName variant,
    Pwd variant,
    RemoteDir variant = '\')
 as
 begin
   FTPSession = ibec_ftp_OpenSession('');
   try
     ibec_ftp_SetProperty(FTPSession, 'HostName', HostName);
     ibec_ftp_SetProperty(FTPSession, 'UserName', UserName);
     ibec_ftp_SetProperty(FTPSession, 'Password', Pwd);
 
     --ibec_ftp_SetProperty(FTPSession, 'PassiveMode', FALSE);
     --ibec_ftp_SetProperty(FTPSession, 'TransferMode', 'ASCII');
 
     Res = ibec_ftp_Connect(FTPSession);
 
     if (Res) then
     begin
       if (ibec_ftp_ChangeDir(FTPSession, RemoteDir)) then
         ibec_ftp_MakeDir(FTPSession, 'DataFiles');
         ibec_ShowMessage(ibec_ftp_LastResponse(FTPSession));
       if (ibec_ftp_Rename(FTPSession, 'db.fdb', 'old_db.fdb')) then 
         ibec_ShowMessage(ibec_ftp_LastResponse(FTPSession));
       ibec_ftp_RemoveDir(FTPSession, 'DataFiles');
       ibec_ShowMessage(ibec_ftp_LastResponse(FTPSession));
 
     end
 
   finally
     ibec_ftp_CloseSession(FTPSession);
   end;
 end;