Discuss this help topic in SecureBlackbox Forum

SFTP: Append or modify the remote file

To append or modify the remote file, use OpenFile/Write/ CloseHandle sequence of methods of TElSimpleSFTPClient class.

Use OpenFile() or CreateFile() method of TElSimpleSFTPClient class to open or create the file and get a file handle. The methods accept the absolute path to the remote file in the "/path/to/file.ext" form (SFTP doesn't have a concept of "current directory") as a parameter.

The next step is to use Write() method to transfer the data. Don't pass the whole data block to this method. Use chunks which are smaller than 1 Mb. Write() method accepts Offset as a parameter, letting you specify the offset in the file, where the data is written.

When you finish writing the data, use CloseHandle() method to close the file.

All of the above methods are synchronous and return when the operation is completed.

For information about error handling, see the corresponding how-to article.

How To articles about SFTP client

Discuss this help topic in SecureBlackbox Forum