Topic ".Net Library Remove Files"

Author Message
[View user's profile]

Joined: 2013-03-19
Posts: 1
Location: Maryland
I am running WinSCP 5.1.3 (build 2881). I am using the .Net library and writing a C# console application. I am connecting with SFTP-3 protocol.

My program is retrieving all the files (based on fileMask) in a remote directory. I don't want to get the files a second time, so I would like to delete the files after I successfully download them.

I have tried setting the Session.RemoveRemoteFiles parameter to true and have tried explicitly calling the Session.RemoveFiles method and passing a full path, including a specific file name. If the file being removed is the last file in the remote directory, WinSCP also removes the directory. Is this expected behavior? If so, it there a way to delete the last file in a remote directory, without removing the remote directory?

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24736
Location: Prague, Czechia
Session.RemoveFiles should not remove the directory with the last file.
Please attach your code along with complete session log file (Session.SessionLogPath).
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