Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: .Net Library Remove Files

Session.RemoveFiles should not remove the directory with the last file.
Please attach your code along with complete session log file (Session.SessionLogPath).
gcrawfo

.Net Library Remove Files

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?

Thanks,
gary