文件是否存在
(filepath string)
| 193 | |
| 194 | // 文件是否存在 |
| 195 | func (instance *SSHRemote) IsDirExist(filepath string) bool { |
| 196 | |
| 197 | filepath = instance.ConvertFilePath(filepath) |
| 198 | |
| 199 | command := fmt.Sprintf(`[[ -d "%v" ]] && echo "1" || echo "0"`, filepath) |
| 200 | outContent, err := instance.ExeSSHCommand(command) |
| 201 | CheckError(err) |
| 202 | |
| 203 | return outContent == "1" |
| 204 | } |
| 205 | |
| 206 | // 文件是否存在 |
| 207 | func (instance *SSHRemote) IsDirEmpty(dirPath string) bool { |
no test coverage detected