Post a reply

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

mmedic

Issue seems to be related to directories that start with '['. If I remove that the remove works. Log attached.
martin

Re: How to properly delete remote directory using .NET library

mmedic wrote:

I have tried using Session.RemoveFiles with and without a trailing slash but without success. Operation succeeds but the RemovalOptionResult shows 0 removals. I have verified that the directory exists on the remote server. It does contain [] (brackets) in the name. I am not sure if that causes any issues.

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. 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 can mark the attachment as private.
mmedic

I assume you meant to say "Session.RemoveFiles should not remove the directory with [at least one] file [in it]." My directory is indeed empty but once the command is executed it reports that there was no match found.

In any event, how does not remove a directory (empty or not)? I downloaded the source code and created a method RemoveDirectory which calls
rmdir -- "dir_name"
and that works but the original library does not seem to provide this functionality. I am missing something?
mmedic

How to properly delete remote directory using .NET library

I have tried using Session.RemoveFiles with and without a trailing slash but without success. Operation succeeds but the RemovalOptionResult shows 0 removals. I have verified that the directory exists on the remote server. It does contain [] (brackets) in the name. I am not sure if that causes any issues.