0 votes
by (150 points)

Hi,
Are Rename method parameters (fromPath and toPath) absolute paths?

For instance, will the following code work correctly?

var _ftp = new Sftp();

// Connect and login

_ftp.ChangeDirectory("/home/tmp");

_ftp.PutFile("test.txt", "test.txt");
_ftp.Rename("/home/tmp/test.txt", "/home/uat/test.txt");
Applies to: Rebex SFTP

1 Answer

0 votes
by (72.7k points)
selected by
 
Best answer

All paths given to methods of the Rebex.Net.Sftp object can be of both kinds absolute or relative.

Path starting with slash '/' is taken as absolute path.
Path not starting with slash '/' is taken as relative path.

by (150 points)
Just to be sure.
If the SFTP user has the current directory as "/home/user" and I try to upload the file using PutFile ("test.txt", "tmp/test.txt"), the result file name will be "/home/user/tmp/test.txt ", otherwise, if I try to upload the file using PutFile ("test.txt","/tmp/test.txt "), the result file name will be"/tmp/test .text ". Is it right?
by (72.7k points)
Yes, exactly.
by (150 points)
Thanks a lot.
...