ファイルを解凍するときにエラーが発生しました

ファイルを解凍するときにエラーが発生しました

ファイルを解凍するときに次のエラーが発生します

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: uuencode または xxencode テキスト

次のコマンドを実行します。

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で私は

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

関連情報