Topic "Prevent Overwriting using Session.GetFiles"

Author Message
petoefalvi
[View user's profile]

Joined: 2012-06-21
Posts: 1
Location: Bocholt (Germany)
Hello,
I want to download files using 'Session.GetFiles'. But this method seems to overwrite existing files in destination folder. Can this be disabled somehow? I havn't found any topic in the documentation or any option for that.
regards,
Michael
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
So you want to transfer only files that do not exist in the opposite directory?
It's rather a synchronization then.
Use this:
Code:
Session.SynchonizeDirectories(SynchronizationMode.Local, localpath, remotepath, false, false, SynchronizationCriteria.None, null);

https://winscp.net/eng/docs/library_session_synchronizedirectories
_________________
Martin Prikryl
SP2100
[View user's profile]

Joined: 2014-01-10
Posts: 3
Hi,
I tried to use your example here so that existing files are not overwritten in local folder , but it's not working. Local file though being new is being replaced by older file from server. Is there any other setting I need to follow?

session.SynchronizeDirectories(SynchronizationMode.Local, localPath, remotePath,false,false, SynchronizationCriteria.None, null);


I am using following statement to get files.

session.GetFiles(remotePath, localPath,false, transferOptions).Check();



Thanks!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
SP2100 wrote:
Hi,
I tried to use your example here so that existing files are not overwritten in local folder , but it's not working. Local file though being new is being replaced by older file from server. Is there any other setting I need to follow?

session.SynchronizeDirectories(SynchronizationMode.Local, localPath, remotePath,false,false, SynchronizationCriteria.None, null);

Please set Session.SessionLogPath and attach a log showing the problem. Ideally on a very small set (one?) of files.
Advertisements

You can post new topics in this forum






Search Site

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License