fix: SSH工具远程复制文件夹创建

This commit is contained in:
TsMask
2025-01-20 17:16:09 +08:00
parent 1643697dcc
commit 5bac221cdf
2 changed files with 5 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ func FileList(sshClient *ConnSSH, path, search string) ([]FileListRow, error) {
// 是否远程客户端读取 // 是否远程客户端读取
if sshClient == nil { if sshClient == nil {
resultStr, err := cmd.Execf(cmdStr) resultStr, err := cmd.Exec(cmdStr)
if err != nil { if err != nil {
logger.Errorf("Ne FileList Path: %s, Search: %s, Error:%s", path, search, err.Error()) logger.Errorf("Ne FileList Path: %s, Search: %s, Error:%s", path, search, err.Error())
return rows, err return rows, err

View File

@@ -135,10 +135,10 @@ func (s *SSHClientSFTP) CopyFileLocalToRemote(localPath, remotePath string) erro
defer localFile.Close() defer localFile.Close()
// 创建远程目录 // 创建远程目录
// if err := s.Client.MkdirAll(filepath.Dir(remotePath)); err != nil { if err := s.Client.MkdirAll(filepath.Dir(remotePath)); err != nil {
// logger.Errorf("CopyFileLocalToRemote failed to creating remote directory %s: => %s", remotePath, err.Error()) logger.Errorf("CopyFileLocalToRemote failed to creating remote directory %s: => %s", remotePath, err.Error())
// return err return err
// } }
// 创建远程文件 // 创建远程文件
remoteFile, err := s.Client.Create(remotePath) remoteFile, err := s.Client.Create(remotePath)