
解壓縮文件時出現以下錯誤
unzip user_file_batch1.csv.zip
Archive: user_file_batch1.csv
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of user_file_batch1.csv or
user_file_batch1.csv.zip, and cannot find user_file_batch1.csv.ZIP, period.
我相信該文件沒有損壞,或者是多存檔文件的一部分,因為使用存檔實用程式我能夠解壓縮它。我嘗試將其重命名為.zip
但沒有成功。
的輸出type file user_file_batch1.csv.zip
是
user_file_batch1.csv.zip: uuencoded or xxencoded text
答案1
您的檔案有.zip
名稱,但不是 zip 格式。重新命名檔案不會更改其內容,特別是不會神奇地將其轉換為不同的格式。
(或者,不完整的 zip 檔案也可能會發生相同的錯誤 - 但由於存檔實用程式有效,因此情況並非如此。)
運行file user_file_batch1.csv.zip
看看這是什麼類型的檔案。它可能是 Archive Utility 能夠理解的其他類型的存檔。
user_file_batch1.csv.zip:uuencoded 或 xxencoded 文本
運行以下命令:
uudecode user_file_batch1.csv.zip
這將建立一個文件,其名稱在 中指示user_file_batch1.csv.zip
。如果您想選擇不同的輸出檔名:
uudecode -o user_file_batch1.csv.decoded user_file_batch1.csv.zip
此階段的輸出檔案本身可能是一個存檔。 (事實上,也許它是一個 zip 檔案。)file
再次對此檔案運行該實用程式以查看它是什麼。如果您選擇自動檔案名,它可能會提供線索。
答案2
我在做時遇到了類似的問題unzip archive.zip
,給我
檔案:archive.zip
警告 [archive.zip]:...在 zip 檔案開頭或內部有額外位元組
(無論如何都嘗試處理)
錯誤 [archive.zip]:未找到中央目錄的開頭;
zip 檔案損壞。
(請檢查您是否已以適當的 BINARY 模式傳輸或建立了 zip 文件
,並且已正確編譯 UnZip)
做file archive.zip
給了我
壓縮存檔數據
使用7z e archive.zip
有效。
答案3
轉到您的 zip 位置,然後透過此命令解壓縮
jar xvf yourzipfile.zip
答案4
如果您想複製 zip 檔案中的文字內容,只需 gzip 檔案以取得檔案格式並列出內容,請使用 zcat
# unzip ADUReport.zip
Archive: ADUReport.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of ADUReport.zip or
ADUReport.zip.zip, and cannot find ADUReport.zip.ZIP, period.
#gunzip ADUReport.zip
gunzip: ADUReport.zip: unknown suffix -- ignored
zcat ADUReport.zip
#zcat: ADUReport.zip: not in gzip format
#gzip ADUReport.zip
#l
#zcat ADUReport.zip.gz