Hello,
I'm trying to upload a file with a path that I need retained, so when the file is uploaded it would need to create any directories that do not already exist.
Here are my sample attempts:
Rebex.Net.Sftp sftpClient = new Sftp();
sftpClient.Connect(myHost, 22);
sftpClient.Login(usr, pwd);
string source = @"c:\abc\123\test.wav";
string dest = @"abc/123/test.wav";
sftpClient.PutFile(source, dest);
Exception: No such file; No such file. (me: The source does exist)
sftpClient.Upload(source, dest, TraversalMode.Recursive);
Exception: Could not find target directory ('/abc/123/test.wav').
According to the documentation I think that one of these should work but neither does, I just get the exceptions listed above.
If I copy the file to the current directory as in:
string source = @"c:\abc\123\test.wav";
string dest = @"test.wav";
sftpClient.PutFile(source, dest);
This works.
How can I go about doing what I need to do? Do I need to create a function that checks for each directory and creates it if needed?
Walter