SFTP – Change Current Directory

Question:
I need to change directory before uploading (like a cd) since files must be copied into server sub-directories, and I’ve not found any sample or idea ( no ChangeDir or similar).

Answer:
SFTP is Secure File Transfer over SSH. It is not the FTP protocol. There is no similarity or relationship between FTP and SFTP. Therefore, concepts such as “current remote directory” that exist in FTP do not exist with SFTP. With the SFTP protocol, the current directory will always be the home directory of the user account used during SSH/SFTP authentication. You may pass relative or absolute directory/file paths. A relative path is always relative to the home directory of the SSH user account. See this blog post for more details about absolute paths: SFTP Absolute Directory Paths

Further clarification:
“SFTP” is the Secure File Transfer Protocol over SSH. It is a protocol unrelated to the FTP protocol.
The Chilkat SSH / SFTP component is used for “SFTP”. SFTP is achieved by connecting to an SSH server at port 22.

On the other hand, the Chilkat FTP2 components is for FTP. FTP servers listen at port 21 (non-SSL/TLS) and port 990 (SSL). FTP over SSL (i.e. port 990) is called “FTPS”. (not SFTP)

Tags :