Delete Files with with empty spaces in File name using WinSCPNet.dll
When I try to run the below code where I am trying to delete file with empty space in the name:
It gives me the following error:
{"Can't get attributes of file '/testspac/error 2.txt'.\r\nNo such file or directory.\nError code: 2\nError message from server (en): No such file"}
I am not sure how to escape the spaces. I tried wrapping the full path in double quotes and that gave me the same error. I also tried replacing the space with %20 and that did not work too. I am using WinSCPnet.dll version 5.9.1 and file version 1.3.4.6885.
Any pointers would be helpful.
Thanks
Session session = new Session(); SessionOptions sessionOptions = CreateSession(session, hostname, userName, password, timeout); session.Open(sessionOptions); var result = session.RemoveFiles(@"/testspac/error 2.txt"); return result;
It gives me the following error:
{"Can't get attributes of file '/testspac/error 2.txt'.\r\nNo such file or directory.\nError code: 2\nError message from server (en): No such file"}
I am not sure how to escape the spaces. I tried wrapping the full path in double quotes and that gave me the same error. I also tried replacing the space with %20 and that did not work too. I am using WinSCPnet.dll version 5.9.1 and file version 1.3.4.6885.
Any pointers would be helpful.
Thanks