代码之家  ›  专栏  ›  技术社区  ›  Wasi Ahmad

未找到中央目录签名的结尾

  •  0
  • Wasi Ahmad  · 技术社区  · 8 年前

    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.
    

    有人能提出解决这个问题的方法吗?

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

    #!/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
    

    该文件已公开共享。为了进行健全性检查,您可以从 here

    1 回复  |  直到 8 年前
        1
  •  1
  •   Tanaike    8 年前

    下载Google Drive上的共享文件时,需要根据文件大小更改下载方法。结果发现,改变方法时,文件大小的边界约为 40MB

    修改的脚本:

    1、文件大小<40MB

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

    2、文件大小>40MB

    当它试图下载超过40MB的文件时,谷歌表示要从以下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

    #!/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}"