Posted: 2013-03-20 18:57
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?
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).
You can post new topics in this forum
And it's free!