0 votes
by (120 points)

I have an FTP connection to a UNIX system using Rebex FTP/SSL version 4.0.5715.0.

I gave up on trying to download the set since that seems to timeout after the first file, so I'm downloading each individual file.

After calling the download() method, the file on the ftp site disappears. Poof. I have tried the overloaded method to make sure it's a TransferMethod.Copy and still, Poof. Tried many different overloads....

How do I download the file without it automatically calling a delete? is it?

(Is this something happening on the other end possibly? Like THEM deleting the file automatically after it's been downloaded 1 time?)

Ftp ftp = new Ftp();
        try
        {


            ftp.Settings.SslAcceptAllCertificates = true;
            ftp.Settings.SslAllowedVersions = TlsVersion.SSL30 | TlsVersion.TLS10;
            ftp.Settings.ForceListHiddenFiles = true; 
            ftp.Connect(sftpServer, 990, SslMode.Implicit);
            ftp.Login(sftpUser, sftpPassword);
            //var dir = ftp.GetCurrentDirectory();
            var files = ftp.GetList("*.ISA");
            //var fileSet = new Rebex.IO.FileSet(dir);
            //fileSet.Include("*");
            //var set = ftp.GetItems(fileSet);              

          foreach(var file in files)
            {
                try
                {

                    ftp.Download(file.Path, orderDropOffPath,0,Rebex.IO.TransferMethod.Copy,0);
                    if(CheckLastWrite(orderDropOffPath + file.Name))
                    {
                        //delete file!
                    }
                }
                catch (Exception exc)
                {
                    logger.Error(exc);
                }

            }

            ftp.Disconnect();
        }
        catch (Exception e)
        {
            logger.Error(e);
            try
            {
                ftp.Disconnect();
            }
            catch (Exception ex)
            {
                logger.Error(ex);

            }
        }
Applies to: Rebex FTP/SSL

1 Answer

0 votes
by (73.6k points)

It seems that the file is deleted by some process on the server which was not invoked (explicitly) by client.

To be sure that the delete process was not invoked by the client create communication log and see which commands were sent to the server.

The last advice is to use the Ftp.GetFile() method instead of Ftp.Download() method. This will definitely issues only download process.

...