找不到中央目录末尾签名 [英] End-of-central-directory signature not found

查看:124
本文介绍了找不到中央目录末尾签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用linux zip命令创建了zip文件,并将其上传到了我的Google驱动器中.当我尝试使用curl和unzip命令(使用bash文件)下载并解压缩压缩文件时,出现以下错误.

I have created the zip file using linux zip command and uploaded it in my google drive. When I tried to download and unzip the zipped file using curl and unzip command (using a bash file), it gives me the following error.

Archive:  pretrained_models.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 pretrained_models.zip or
        pretrained_models.zip.zip, and cannot find pretrained_models.zip.ZIP, period.

有人可以建议任何解决方法来解决此问题吗?

Can anyone suggest any workaround to fix this issue?

如果有人想重现该错误,我将共享 .sh 文件.

In case if anyone wants to reproduce the error, I am sharing the .sh file.

#!/bin/bash
pretrained='https://drive.google.com/uc?export=download&id=0B8ZGlkqDw7hFSm1MQ2FDVTZCTjA' 
# download pretrained models.
curl -o pretrained_models.zip $pretrained
unzip pretrained_models.zip
rm pretrained_models.zip

文件已公开共享.要进行完整性检查,可以从此处下载.

The file is publicly shared. For sanity check, you can download it from here.

我在SO的其他社区中看到过相关帖子,其中一些建议使用不同的文件扩展名,但我想坚持使用zip文件.

N.B. I have seen related posts in other community of SO and some of them suggested to use different file extension but I want to stick to zip file.

推荐答案

在下载Google云端硬盘上的共享文件时,有必要根据文件大小更改下载方法.发现更改方法时文件大小的边界约为 40MB .

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. It was found that the boundary of file size when the method is changed is about 40MB.

#!/bin/bash
filename="pretrained_models.zip"
fileid="0B8ZGlkqDw7hFSm1MQ2FDVTZCTjA"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&id=${fileid}"

2.文件大小> 40MB

Google尝试下载40MB以上的文件时,表示要从以下URL下载.

2. File size > 40MB

When it tries to download the file with more than 40MB, Google says to download from following URL.

<a id="uc-download-link" class="goog-inline-block jfk-button jfk-button-action" href="/uc?export=download&amp;confirm=####&amp;id=### file ID ###">download</a>

包含的查询 confirm = #### 对于下载大文件很重要.为了从HTML检索查询,它使用 pup .

Query included confirm=#### is important for downloading the files with large size. In order to retrieve the query from the HTML, it uses pup.

#!/bin/bash
filename="pretrained_models.zip"
fileid="0B8ZGlkqDw7hFSm1MQ2FDVTZCTjA"
query=`curl -c ./cookie.txt -s -L "https://drive.google.com/uc?export=download&id=${fileid}" | pup 'a#uc-download-link attr{href}' | sed -e 's/amp;//g'`
curl -b ./cookie.txt -L -o ${filename} "https://drive.google.com${query}"

这篇关于找不到中央目录末尾签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆