Sftp Could not find target directory

0 votes
asked Sep 19, 2016 by mertercan83 (220 points)

this is my c# code:

sftp.Upload("C:\xxx", "/root/xxx");

this code throw exception "Could not find target directory" but i'm sure this Ubuntu has this directory. How can i solve this problem ? Where i am looking for?

Applies to: Rebex SFTP

1 Answer

0 votes
answered Sep 19, 2016 by Tomas Knopp (58,580 points)


I do not know what is 'xxx' is this the filename?
If xxx is a file name, you will need this code to upload it:

sftp.Upload(@"C:\filename.txt", "/root/");

or even simpler method (if you only upload single file):

sftp.PutFile(@"C:\filename.txt", "/root/file.txt");

Does it help?