Prevent Overwriting using Session.GetFiles

Advertisement

petoefalvi
Joined:
Posts:
1
Location:
Bocholt (Germany)

Prevent Overwriting using Session.GetFiles

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Prevent Overwriting using Session.GetFiles

So you want to transfer only files that do not exist in the opposite directory?
It's rather a synchronization then.
Use this:
Session.SynchonizeDirectories(SynchronizationMode.Local, localpath, remotepath, false, false, SynchronizationCriteria.None, null);    
https://winscp.net/eng/docs/library_session_synchronizedirectories
_________________
Martin Prikryl

Reply with quote

SP2100
Joined:
Posts:
3

Want to avoid overwritten existing files

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!

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Want to avoid overwritten existing files

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.

Reply with quote

Advertisement

You can post new topics in this forum