pkg / sftp

SFTP support for the go.crypto/ssh package
BSD 2-Clause "Simplified" License
1.5k stars 379 forks source link

how to chdir ? #517

Closed desdic closed 2 years ago

desdic commented 2 years ago

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

puellanivis commented 2 years ago

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.

desdic commented 2 years ago

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