我的应用程序是从服务器下载zip文件并提取此zip文件并将文件保存到SD卡但问题是,如果我下载4-5 MB的zip文件并解压缩,这是工作正常,但如果我正在下载30-35 MB zip文件这会给我错误,抱歉我的英语沟通不好.
下面是我的下载和解压缩Zip文件的代码: -
public class UnzipManager {
private static String BASE_FOLDER;
public static Context localContext;
public static String passurl;
public static int count;
public static Context context;
/*
* You can use this flag to check whether Unzippingthread is still running..
*/
public static boolean isDownloadInProgress;
/*
* After unzipping using this flag ,you can check whether any low memory
* exceptions Occurred or not..and alert user accordingly..
*/
public static boolean isLowOnMemory;
public static int i …Run Code Online (Sandbox Code Playgroud) 从url(http)下载和解压缩文件的正确方法是什么?
如果可能的话,我想防止每次运行任务时重新下载(ant.get可以通过实现skipexisting: 'true').
我目前的解决方案是:
task foo {
ant.get(src: 'http://.../file.zip', dest: 'somedir', skipexisting: 'true')
ant.unzip(src: 'somedir' + '/file.zip', dest: 'unpackdir')
}
Run Code Online (Sandbox Code Playgroud)
不过,我期待无蚂蚁解决方案.有机会实现这一目标吗?
我正在尝试自动提取用7-zip压缩的大量文件.我需要自动化这个过程,因为a)我想要解锁多年的数据和b)我想与其他人分享我的代码,并防止他们手动重复这个过程.
我的计算机上安装了WinRAR和7-zip,我可以使用任一程序轻松打开这些文件.
我环顾四周unzip untar和unz命令,但我不相信他们中的任何一个都能满足我的需求.
我对压缩一无所知,但如果它有任何区别:这些文件中的每一个只包含一个文件,它只是一个文本文件.
我非常喜欢不需要用户安装其他软件(如WinRAR或7-Zip)并执行命令的解决方案shell,尽管我承认只有R和CRAN软件包可能无法执行此任务.我实际上相信shell.exec使用其他参数运行这些文件可能适用于安装了WinRAR的计算机,但同样,我希望尽可能避免安装.:)
运行下面的代码将加载我试图提取的文件 - .7z文件files.data是需要解锁的.
# create a temporary file and temporary directory, download the file, extract the file to the temporary directory
tf <- tempfile() ; td <- tempdir()
file.path <- "ftp://ftp.ibge.gov.br/Orcamentos_Familiares/Pesquisa_de_Orcamentos_Familiares_2008_2009/Microdados/Dados.zip"
download.file( file.path , tf , mode = "wb" )
files.data <- unzip( tf , exdir = td )
# how do i unzip ANY of these .7z …Run Code Online (Sandbox Code Playgroud) 有没有一种简单的方法用golang解压缩文件?
现在我的代码是:
func Unzip(src, dest string) error {
r, err := zip.OpenReader(src)
if err != nil {
return err
}
defer r.Close()
for _, f := range r.File {
rc, err := f.Open()
if err != nil {
return err
}
defer rc.Close()
path := filepath.Join(dest, f.Name)
if f.FileInfo().IsDir() {
os.MkdirAll(path, f.Mode())
} else {
f, err := os.OpenFile(
path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())
if err != nil {
return err
}
defer f.Close()
_, err = io.Copy(f, rc)
if err != …Run Code Online (Sandbox Code Playgroud) 有关如何解压缩管道zip文件的任何想法,如下所示:
wget -qO- http://downloads.wordpress.org/plugin/akismet.2.5.3.zip
Run Code Online (Sandbox Code Playgroud)
我希望将文件解压缩到一个目录,就像我们以前使用普通文件一样:
wget -qO- http://downloads.wordpress.org/plugin/akismet.2.5.3.zip | unzip -d ~/Desktop
Run Code Online (Sandbox Code Playgroud) 我的桌面上有一个文件夹,里面有大约2500个文件夹,每个文件夹中都有多个压缩文件,我可以通过手动点击它们解压缩它们,有没有办法通过终端自动完成?
我有一个包含.ZIP文件的文件夹.现在,我想使用C#将ZIP文件解压缩到特定文件夹,但不使用任何外部程序集或.Net Framework 4.5.
我搜索过,但没有找到任何使用Framework 4.0或更低版本解压缩*.zip文件的解决方案.
我尝试过GZipStream,但它只支持.gz而不支持.zip文件.
我需要创建一个shell脚本,其中我将解压缩受密码保护的zip文件.我知道密码,需要自动化解压缩过程.
如何使用Unix shell脚本实现这一目标?
我有一些zip非常大的文件,我想打印它们而不先提取.我正在使用zcat并zless执行此操作,然后将输出重定向到其他应用程序.当我的zip文件包含多个文本文件时,我收到以下错误:
zcat tweets.zip >a
gzip: tweets.zip has more than one entry--rest ignored
Run Code Online (Sandbox Code Playgroud)
如何使用zip包含多个文本文件的文件执行我想要的操作?