unzip

read the files one by one in a zip file using bash

佐手、 提交于 2020-01-05 04:31:30
问题 I want to open the files inside a .zip file and read them. In this zip file, I have numerous .gz files, like a.dat.gz, b.dat.gz, and so on. My code so far: for i in $(unzip -p sample.zip) do for line in $(zcat "$i") do # do some stuff here done done 回答1: You are correct in needing two loops. First, you need a list of files inside the archive. Then, you need to iterate within each of those files. unzip -l sample.zip |sed ' /^ *[0-9][0-9]* *2[0-9-]* *[0-9][0-9]:[0-9][0-9] */!d; s/// ' |while

How to unzip a file in IsolatedStorage in windows phone 8 app?

不打扰是莪最后的温柔 提交于 2020-01-03 16:52:36
问题 Inside my app, I am trying to download about 180 small audio files all at once. I tried the BackgroundTransferService, but it does not seem stable with so many small files. So, now I am downloading a ZIP of all those audio and want extract them in "audio" folder. I tried the method in this thread: How to unzip files in Windows Phone 8 But I get this error: 'System.IO.IOException' occurred in mscorlib.ni.dll... in the following code. How can I overcome this issue? while (reader.ReadInt32() !=

Extract .gz files in java

本秂侑毒 提交于 2020-01-03 15:12:06
问题 I'm trying to unzip some .gz files in java. After some researches i wrote this method: public static void gunzipIt(String name){ byte[] buffer = new byte[1024]; try{ GZIPInputStream gzis = new GZIPInputStream(new FileInputStream("/var/www/html/grepobot/API/"+ name + ".txt.gz")); FileOutputStream out = new FileOutputStream("/var/www/html/grepobot/API/"+ name + ".txt"); int len; while ((len = gzis.read(buffer)) > 0) { out.write(buffer, 0, len); } gzis.close(); out.close(); System.out.println(

Unzip .gz file using c#

我只是一个虾纸丫 提交于 2020-01-03 07:09:07
问题 How to unzip .gz file and save files in a specific folder using c#? This is the first time I encounter a .gz file. I've search in how to unzip it yet It didn't work for me. It didn't unzip .gz file in a specific folder. I don't want to used any third party application. Can anyone gave me a sample code on how to unzip it. Then save file in a folder. Thanks. 回答1: The following example from MSDN shows how to use the GZipStream class to compress and decompress a directory of files. namespace zip

PHP Unzip very large file

笑着哭i 提交于 2020-01-02 05:22:26
问题 I have a zip file on the server. It's 1.1gb made up of thousands of small files. I do not have shell or root access to the server and can only use ftp and create php files.. so far I have tried exec and shell exec but none worked. The server is running free bsd. How can I unzip the file into the directory it is in? 回答1: For a pure PHP solution, try PclZip - this would not require you to install any PHP extensions or require shell access - you just need to write access to wherever you want to

Unzipping file Zip Exception: invalid entry size (expected 193144 but got 193138 bytes)

杀马特。学长 韩版系。学妹 提交于 2020-01-02 02:43:07
问题 I am trying to unzip a file (retrieved from an FTP server): ZipInputStream zis = new ZipInputStream( new FileInputStream(zipFile)); ZipEntry ze = zis.getNextEntry(); while (ze != null) { String fileName = ze.getName(); File newFile = new File(outputFileName+outputFolder + File.separator + fileName); System.out.println("file unzip : " + newFile.getAbsoluteFile()); FileOutputStream fos = new FileOutputStream(newFile); int len; while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); }

How to unzip a big zip file containing one file and get the progress in bytes with swift?

旧巷老猫 提交于 2019-12-31 19:40:07
问题 I try to unzip a big zip file containing only one item (more than 100MB) and like to show the progress during unzipping. I found solutions where the progress can be determined based on the amount of files unzipped but in my case I have only one big file inside. So I guess it must be determined by the amount of bytes unzipped? Actually I am using SSZipArchive with the following code which works fine: var myZipFile:NSString="/Users/user/Library/Developer/CoreSimulator/Devices/mydevice/ziptest

Extract certain files from .zip

人走茶凉 提交于 2019-12-30 06:56:15
问题 Is there a way to selectively extract from a .zip archive those files with names matching a pattern? For example, if I want to use all .csv files from the archive and ignore other files. Current approach: zipped_file_names <- unzip('some_archive.zip') # extracts everything, captures file names csv_nms <- grep('csv', zipped_file_names, ignore.case=TRUE, value=TRUE) library('data.table') comb_tbl <- rbindlist(lapply(csv_nms, function(x) cbind(fread(x, sep=',', header=TRUE, stringsAsFactors

Need PHP script to decompress and loop through zipped file

耗尽温柔 提交于 2019-12-29 08:03:39
问题 I am using a fairly straight-forward script to open and parse several xml files that are gzipped. I also need to do the same basic operation with a ZIP file. It seems like it should be simple, but I haven't been able to find what looked like equivalent code anywhere. Here is the simple version of what I am already doing: $import_file = "source.gz"; $sfp = gzopen($import_file, "rb"); ///// OPEN GZIPPED data while ($string = gzread($sfp, 4096)) { //Loop through the data /// Parse Output And Do

Unzip password protected zip files in R

痞子三分冷 提交于 2019-12-29 07:06:29
问题 A password cannot be specified in unzip ( utils ) function. The other function I am aware of, getZip ( Hmisc ), only works for zip files containing one compressed file. I would like to do something like this to unzip all the files in foo.zip in Windows 8: unzip("foo.zip", password = "mypass") 回答1: I found this question very useful but saw that no formal answers were posted, so here goes: First I installed 7z. Then I added "C:\Program Files\7-Zip\" to my environment path. I tested that the 7z