unzip 批量解压多个文件+End-of-central-directory signature not found

来源:互联网 发布:手机刷机后数据恢复 编辑:程序博客网 时间:2024/05/20 13:05

#find . -name ‘*.zip’ -exec unzip {} \;

2.
#ls *.zip | xargs -n1 unzip

3.
# for i in *
do
unzip $i
done


unzip批量解压到指定目录下

在yyy目录下有很多.zip文件,里面有个xxx目录,要把.zip文件以本身文件名建一个目录 解压到xxx目录下。shell脚本如下

for file in *.zip
do
filename=$(echo $file|cut -d'.' -f1)
unzip $file -d xxx/$filename
done

自己记录下。主要用到字符串变量处理,一开始想到,没想到用sed cut grep awk等。。

配合着资料。终于 成功了!



  Linux 下,使用unzip解压时,报错:

unzip trunk.zip

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

  文件大小为 2.2G,可能是 unzip 设置了这个限制吧。在网上查到要用 jar 来解

jar xvf trunk.zip

  如果出现

jar:Command not found

  要用yum下载

yum -y install java-1.6.0-openjdk-devel

再次运行

jar xvf trunk.zip

就能成功,看来,unzip局限蛮大的呀。


  Linux 下,使用unzip解压时,报错:

unzip trunk.zip

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

  文件大小为 2.2G,可能是 unzip 设置了这个限制吧。在网上查到要用 jar 来解

jar xvf trunk.zip

  如果出现

jar:Command not found

  要用yum下载

yum -y install java-1.6.0-openjdk-devel

再次运行

jar xvf trunk.zip

就能成功,看来,unzip局限蛮大的呀。

原创粉丝点击