文件是否存在
(filepath string)
| 181 | |
| 182 | // 文件是否存在 |
| 183 | func (instance *SSHRemote) IsFileExist(filepath string) bool { |
| 184 | |
| 185 | filepath = instance.ConvertFilePath(filepath) |
| 186 | |
| 187 | command := fmt.Sprintf(`[[ -f "%v" ]] && echo "1" || echo "0"`, filepath) |
| 188 | outContent, err := instance.ExeSSHCommand(command) |
| 189 | CheckError(err) |
| 190 | |
| 191 | return outContent == "1" |
| 192 | } |
| 193 | |
| 194 | // 文件是否存在 |
| 195 | func (instance *SSHRemote) IsDirExist(filepath string) bool { |
no test coverage detected