Hi,
After the connexion to an SFTPServer,
How to change the current working directory with TScSFTPClient ?
I don't find this function !?
Thanks.
Change current working directory with TScSFTPClient ...
In SFTP protocol the "current working directory" concept doesn't exist. You can open a directory using the OpenDirectory method, and you can get an absolute path to any directory using the RetrieveAbsolutePath method.
You can look at the example of working with SFTP client using the SFTPClient demo.
You can look at the example of working with SFTP client using the SFTPClient demo.
Re: Change current working directory with TScSFTPClient ...
I would like to upload a text file in a Testing folder in the remote server.
This following code works well.
Without calling RetrieveAbsolutePath after OpenDirectory the UploadFile will be failed. Is this really the behaviour?
This following code works well.
Code: Select all
sftp.OpenDirectory('Testing');
sftp.RetrieveAbsolutePath('Testing', rcNoCheck, list);
sftp.UploadFile('c:\temp\test.txt', 'Testing\test.txt', True);
-
- Devart Team
- Posts: 70
- Joined: Wed 02 Jun 2021 09:30
Re: Change current working directory with TScSFTPClient ...
Hi There,
In fact, no.
The RetrieveAbsolutePath, OpenDirectory and UploadFile methods is not modal, therefor they should NOT depend on each other. Thus, they can be called in any sequence, and it should not cause any fails.
Since you only need to upload a file, it’s enough to call only:
Regards,
Vitaliy
In fact, no.
The RetrieveAbsolutePath, OpenDirectory and UploadFile methods is not modal, therefor they should NOT depend on each other. Thus, they can be called in any sequence, and it should not cause any fails.
Since you only need to upload a file, it’s enough to call only:
Code: Select all
ScSFTPClient.UploadFile([localpath\filename], [ftpserverpath\filename], True)
Vitaliy