使用ftp的get命令取文件下来,发现解压失败,报错如下:
gzip: stdin: invalid compressed data--format violated
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
经查是因为在ftp传输中默认是使用ASCII模式传输而非BIN模式,导致压缩文件在传输过程中文件损坏。
解决方法:
只需要在连接ftp后,执行binary命令,再使用get获取文件即可