尝试从 tar 文件中提取所有文件时,我收到以下错误消息:
tar: Skipping to next header
tar: Error exit delayed from previous errors
Run Code Online (Sandbox Code Playgroud)
在打印此错误消息之前,某些文件已正确提取,并且该过程会导致出现似乎包含存档其余部分的乱码文件。此存档中的所有文件都是文本文件。
有什么我可以尝试恢复其余文件的吗?
您可以使用 -i 选项尝试提取以忽略零:
The --ignore-zeros (-i) option causes tar to ignore blocks of zeros in
the archive. Normally a block of zeros indicates the end of the archive,
but when reading a damaged archive, or one which was created by cat-ing
several archives together, this option allows tar to read the entire
archive. This option is not on by default because many versions of tar
write garbage after the zeroed blocks.
Run Code Online (Sandbox Code Playgroud)
您可以尝试其他版本的 tar:gnu tar、star、bsdtar 等。其中之一可能会更好地处理错误。
您说您的文件都是文本文件,因此您应该能够手动编辑文件并选择每个文件并将其复制/粘贴到新文件。查找每个文件之间的 tar 分隔符,它看起来像一个 ASCII NULL 块,其中嵌入了文件的元数据(名称、权限、时间戳等)。