C# session.GetFiles "remove" parameter not working?

Advertisement

Kcs2c
Joined:
Posts:
2
Location:
Richmond, VA

C# session.GetFiles "remove" parameter not working?

This may be a problem on the server end rather than with WinSCP (as detailed below) but I'd like to stop here.

OS: Windows Server 2008
WinSCP: v2.0.50727
App Coded in VS2012, 32 bit

Summary: I have to pick up a file via SFTP that is placed there every 30 minutes. I would like to leave the copy there rather than remove it. No matter which way I set the flag on session.GetFiles it deletes.

Oddness: If I use the same code to pick up a copy of the file _that I placed there_ the copy deletes or does not delete appropriately <= makes me think the rights on the files are different, but they appear to be the same in both the log files and the WinSCP application.

Code used:

TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Ascii;

session.GetFiles(remotePath, localPath, false, transferOptions).Check();
Description: This is the logfile with the parameter set to false for "remove file" but deletes anyway. I have the other 3 combinations.

Reply with quote

Advertisement

Kcs2c

I think there is something about the file I am copying. When I use WinSCP 5.1.5 build 3261 and drag and drop, the server generated file is deleted when I take from remote to local, when I drag a copy of the fin=le that I brought under a different name into the directory it is not deleted.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: C# session.GetFiles "remove" parameter not working?

It looks like there's some process on the server-side that removes the file once it is downloaded.
Please attach a full log file showing the problem (using the latest version of WinSCP). Use drag&drop for the download test, not .NET code.

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

Reply with quote

Advertisement

You can post new topics in this forum