如何像命令-cd一样进入目录,从而操作不带路径前缀的远程文件?
这是我当前的代码。
Net::SFTP.start do |sftp|
sftp.rename!(REMOTE_PATH + "latest.zip", REMOTE_PATH + "latest.back.zip")
sftp.upload!("latest.zip", REMOTE_PATH + "latest.zip")
end
我想拥有:
sftp.cd REMOTE_PATH
sftp.rename!("latest.zip", "latest.back.zip")
sftp.upload!("latest.zip", "latest.zip")