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

Author Message
[View user's profile]

Joined: 2013-11-08
Posts: 2
Location: Richmond, VA
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();
NotDeleteNativeButDoeslogfile.txt (64.61 KB) [Download]

Description: This is the logfile with the parameter set to false for "remove file" but deletes anyway. I have the other 3 combinations.

[View user's profile]

Joined: 2013-11-08
Posts: 2
Location: Richmond, VA
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.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
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.
Martin Prikryl

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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License