How to properly delete remote directory using .NET library

Advertisement

mmedic
Joined:
Posts:
3
Location:
USA

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.

Reply with quote

Advertisement

mmedic
Joined:
Posts:
3
Location:
USA

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?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

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.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum