Topic "c# - Copy only new files from Zip"

Author Message
[View user's profile]

Joined: 2016-06-27
Posts: 1
Location: netherlands

So i have a zip file on my SFTP server. In this zip file there are files.

And i have a zip file on my pc.

What i want is that when i push a button in my C# application, the zip file on my pc will be updated. So lets say if the zip file on the sftp server has a new file in it. The ftp function will only update the zip file on the pc with that file.

Currently it always overwrite the zip file.

Is this possible?

thanks , Thomas


SessionOptions sessionOptions = new SessionOptions
                //i have information here.               
                    Protocol =
                    HostName = "",
                    UserName = "",
                    Password = "",
                    SshHostKeyFingerprint = "",

                using (Session session = new Session())
                    session.FileTransferProgress += SessionFileTransferProgress;
                    TransferOptions transferOptions = new TransferOptions();
                    transferOptions.TransferMode = TransferMode.Binary;
                    transferOptions.OverwriteMode = OverwriteMode.Overwrite;
                    TransferOperationResult transferResult;
                    transferResult = session.GetFiles("[file on server]","[file on pc]", false, new TransferOptions { FilePermissions =  null, PreserveTimestamp = false });
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
All you can do is to download the file to a local temporary folder, compare the contents and overwrite, if there's a change.

But in the end, it's the same as comparing the timestamp of the ZIP files and overwrite the local ZIP file whenever the remote file is newer.

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License