unzip

download a zip file to a local drive and extract all files to a destination folder using python 2.5

血红的双手。 提交于 2019-11-30 16:14:31
I am trying to download a zip file to a local drive and extract all files to a destination folder. so i have come up with solution but it is only to "download" a file from a directory to another directory but it doesn't work for downloading files. for the extraction, I am able to get it to work in 2.6 but not for 2.5. so any suggestions for the work around or another approach I am definitely open to. thanks in advance. ###################################### '''this part works but it is not good for URl links''' import shutil sourceFile = r"C:\Users\blueman\master\test2.5.zip" destDir = r"C:

Unzip file from zip archive of multiple files using ZipFile class

痞子三分冷 提交于 2019-11-30 15:21:22
I'd like to use the ZipFile class to unzip a file using its name from an archive of multiple files. How can I get the string of the zip file name and directory to pass to the ZipFile constructor? You can use the AssetManager and ZipInputStream http://developer.android.com/reference/android/content/res/AssetManager.html ZipInputStream in = null; try { final String zipPath = "data/sample.zip"; // Context.getAssets() in = new ZipInputStream(getAssets().open(zipPath)); for (ZipEntry entry = in.getNextEntry(); entry != null; entry = in.getNextEntry()) { // handle the zip entry } } catch

linux 下压缩、解压缩命令 tar zip unzip

为君一笑 提交于 2019-11-30 15:06:41
tar命令 : 利用tar命令,可以把一大堆的文件和目录全部打包成一个文件,这对于备份文件或将几个文件组合成为一个文件以便于网络传输是非常有用的。 首先要弄清两个概念:打包和压缩。打包是指将一大堆文件或目录变成一个总的文件;压缩则是将一个大的文件通过一些压缩算法变成一个小文件。 为什么要区分这两个概念呢?这源于Linux中很多压缩程序只能针对一个文件进行压缩,这样当你想要压缩一大堆文件时,你得先将这一大堆文件先打成一个包(tar命令),然后再用压缩程序进行压缩(gzip bzip2命令)。 语法 tar(选项)(参数) 选项 -c或--create:建立新的备份文件; -C <目录>:这个选项用在解压缩,若要在特定目录解压缩,可以使用这个选项。 -x或--extract或--get:从备份文件中还原文件; -f<备份文件>或--file=<备份文件>:指定备份文件; -j:支持bzip2解压文件; -v:显示操作过程; -p或--same-permissions:用原来的文件权限还原文件; 参数 文件或目录:指定要打包的文件或目录列表。 常用tar命令 压 缩:tar -zcvf /home/zdzlibs.tar.gz /home/zdz/java/zdzlibs/ 解压缩:tar -zxvf 【压缩包文件名.tar.gz】 -C 【路径】 #注释:解压.tar

open failed: EBUSY (Device or resource busy)

喜夏-厌秋 提交于 2019-11-30 11:18:25
问题 I have a strange error in my App. In my app it is possible to download a zipFile, read the content as what it is and also delete it. Its doesn't matter what exactly it is. Problem: Only on the Motorola Xoom (version 4.0.4) I can download the file, unzip it, I can read the data and I can delete everything. But if I try to Download the file again and while it unzip the file and copy the files to SD-Card it crashes with the error EBUSY (Device or resource busy). Why is it working only the first

Read a file inside a Zip archive and put its content into a String in Android

核能气质少年 提交于 2019-11-30 10:34:50
this is my first question, although I've already used so many tips from Stack Overflow. But for this situation I haven't found a solution yet. Here's the situation: I have a zipped file and I want to read a specific file and put its content into a String variable, that will be returned and put into a TextView in Android. I don't want the file to be written to sdcard, I just want to perform a memory operation. For example, inside db.zip I have a file named packed.txt, which content is "Stack á é ç". The returned String in my method shows "83 116 97 99 107 32 195 161 32 (...)" which are the UTF

Linux(八)—— Linux 指令(文件目录类、时间日期类、搜索查找类、压缩和解压类)

对着背影说爱祢 提交于 2019-11-30 09:36:27
文章目录 一、Linux 常用指令 1、Linux 文件目录类指令 (1)pwd 指令 (2)ls 指令 (3)cd 指令 (4)mkdir 指令 (5)rmdir 指令 (6)touch 指令 (7)cp 指令 (8)rm 指令 (9)mv 指令 (10)cat指令 (11)more 指令 (12)less 指令 (13)> 和 >> 指令 (14)echo/head/tail 指令 (15)ln 指令 (16)history 指令 2、Linux 时间日期类指令 (1)date 指令 (2)cal 指令 3、Linux 搜索查找类指令 (1)find 指令 (2)locate 指令 (3)grep 指令和管道符号| 4、Linux 压缩和解压类指令 (1)gzip/gunzip 指令 (2)zip/unzip 指令 (2)tar 指令 一、Linux 常用指令 1、Linux 文件目录类指令 (1)pwd 指令 语法: pwd 解释:显示当前工作路径的相对路径 (2)ls 指令 语法: ls [选项] [文件或目录] 常用选项: -a :显示当前目录所有的文件和目录,包括隐藏的 -l :以列表的形式显示所有信息,不含隐藏文件 -al :以列表的形式显示所有信息,包含隐藏文件 解释:显示目录下所有的文件和目录 (3)cd 指令 语法: ls [参数] 解释:切换到指定的目录

Creating and serving zipped files with php

允我心安 提交于 2019-11-30 09:05:00
问题 I'm trying to use the following code to create a zip file from a directory and serve it to the user via an http download: // write the file file_put_contents($path . "/index.html", $output); // zip up the contents chdir($path); exec("zip -r {$course->name} ./"); $filename = "{$course->name}.zip"; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' .urlencode($filename)); header('Content-Transfer-Encoding: binary'); readfile($filename); I am

How can I unzip a .gz file with PHP?

大城市里の小女人 提交于 2019-11-30 06:38:11
问题 I'm using CodeIgniter and I can't figure out how to unzip files! 回答1: Download the Unzip library and include or autoload the unzip library $this->load->library('unzip'); 回答2: PHP itself has a number of functions for dealing with gzip files. If you want to create a new, uncompressed file, it would be something like this. Note: This doesn't check if the target file exists first, doesn't delete the input file, or do any error checking. You really should fix those before using this in production

Unzip Archive with Groovy

丶灬走出姿态 提交于 2019-11-30 06:24:34
is there a built-in support in Groovy to handle Zip files (the groovy way)? Or do i have to use Java's java.util.zip.ZipFile to process Zip files in Groovy ? AFAIK, there isn't a native way. But check out this article on how you'd add a .zip(...) method to File, which would be very close to what you're looking for. You'd just need to make an .unzip(...) method. Maybe Groovy doesn't have 'native' support for zip files, but it is still pretty trivial to work with them. I'm working with zip files and the following is some of the logic I'm using: def zipFile = new java.util.zip.ZipFile(new File(

Unzip a bunch of zips into their own directories

时间秒杀一切 提交于 2019-11-30 03:40:39
I have a bunch of zip files I want to unzip in Linux into their own directory. For example: a1.zip a2.zip b1.zip b2.zip would be unzipped into: a1 a2 b1 b2 respectively. Is there any easy way to do this? for file in *.zip do unzip -d "${file%.zip}" $file done for zipfile in *.zip; do exdir="${zipfile%.zip}" mkdir "$exdir" unzip -d "$exdir" "$zipfile" done for x in $(ls *.zip); do dir=${x%%.zip} mkdir $dir unzip -d $dir $x done user3019558 Sorry for contributing to an old post, this works in cmd line for me and it was a life saver when I learnt about it for file in $(ls *.zip); do unzip $file