百度网盘打包下载后是pack.zip,如果下载的内容是中文的话,直接用zip解压是会出现乱码
[t@bjb0541 ~]$ unzip pack.zip
Archive: pack.zip
creating: -?+?/TCP-IP???/
extracting: -?+?/TCP-IP???/TCP-IP????2??-???.pdf
extracting: -?+?/TCP-IP???/TCP-IP????1??????.pdf
extracting: -?+?/TCP-IP???/TCP-IP????3??TCP--+?????.pdf
[t@bjb0541 ~]$ ^C
[t@bjb0541 ~]$ cd /home/talen/-?+?
bash: cd: /home/talen/-?+?: No such file or directory
[t@bjb0541 ~]$ ls -l
...
2621858 drwx------. 3 t t 4096 Mar 23 16:07 ?鼮
下面是解决方法:
创建/tmp/a目录,在此目录下解决文件.创建此目录的目的是减少第二步搜索的范围.
[t@bjb0541 ~]$ cd /tmp/a/
[t@bjb0541 a]$ LANG=C ; 7z x /home/talen/pack.zip
7-Zip [64] 15.09 beta : Copyright (c) 1999-2015 Igor Pavlov : 2015-10-16
p7zip Version 15.09 beta (locale=C,Utf16=off,HugeFiles=on,64 bits,4 CPUs Intel(R) Core(TM) i3 CPU M 380 @ 2.53GHz (20655),ASM)
Scanning the drive for archives:
1 file, 54796877 bytes (53 MiB)
Extracting archive: /home/talen/pack.zip
--
Path = /home/talen/pack.zip
Type = zip
Physical Size = 54796877
执行convmv -f GBK -t utf8 --notest -r .
[t@bjb0541 a]$ convmv -f GBK -t utf8 --notest -r .
mv "./?鼮/TCP-IP????/TCP-IP??????3??TCP????Э??.pdf" "./?鼮/TCP-IP????/TCP-IP详解卷3:TCP事务协议.pdf"
mv "./?鼮/TCP-IP????/TCP-IP??????1??Э??.pdf" "./?鼮/TCP-IP????/TCP-IP详解卷1:协议.pdf"
mv "./?鼮/TCP-IP????/TCP-IP??????2?????.pdf" "./?鼮/TCP-IP????/TCP-IP详解卷2:实现.pdf"
mv "./?鼮/TCP-IP????" "./?鼮/TCP-IP详解"
mv "./?鼮" "./书籍"
Ready! I converted 5 files in 0 seconds.
可以看到非常完美.
有一些包7z可能解压出来是0字节,可以试下python脚本:
-
#!/usr/bin/env python
-
# -*- coding: utf-8 -*-
-
import os
-
import sys
-
import zipfile
-
#print "Processing File " + sys.argv[1]
-
file=zipfile.ZipFile(sys.argv[1],"r");
-
for name in file.namelist():
-
utf8name=name.decode('gbk')
-
# print "Extracting " + utf8name
-
pathname = os.path.dirname(utf8name)
-
if not os.path.exists(pathname) and "":
-
os.makedirs(pathname)
-
data = file.read(name)
-
if not os.path.exists(utf8name):
-
fo = open(utf8name, "w")
-
fo.write(data)
-
fo.close
-
file.close()
-
-
#作者:Latm Ake
-
#链接:http://www.zhihu.com/question/20523036/answer/35225920
-
#来源:知乎
-
#著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
参考:
阅读(3267) | 评论(0) | 转发(0) |