pkg / sftp

SFTP support for the go.crypto/ssh package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to chdir ?

desdic opened this issue · comments

The documentation says it mimics the os package but I can't seem to find a way to change directory only to get current directory

We haven’t written in any support for tracking a local directory, because there is not really any proper way to handle changing remote directories. That is, upon connecting, the remote working directory is set to your home directory, and then, as mentioned, it cannot actually be changed.

“But every sftp client I have used supports changing remote working directory.” Yes, but also technically no. They track the “current remote working directory” internally, and only send complete absolute directories.

And rather than dictate how that should be done on our client side, we’ve left this as a problem for the caller to track. Though, it might be better if we supported a way to get a reasonable implementation. If we ever try and implement the io/fs.SubFS this would be something we would want to support anyways.

Thank you clarifying .. I'll track it in my client, closing