unzip

How do I write a BASH script to download and unzip file on a Mac?

那年仲夏 提交于 2019-12-03 04:59:10
I need to create a bash script that will work on a mac. It needs to download a ZIP file of a site and unzip it to a specific location. Download the ZIP file ( curl -O ) Unzip the files to a specific location ( unzip filename.zip path/to/save ) Delete the .zip file I need to make it so people can double-click the text file on their desktop and it will automatically run in terminal. How do I make it so that the user can double click the icon on the desktop and it will run? What extension does the file need? OSX uses the same GNU sh/bash as Linux #!/bin/sh mkdir /tmp/some_tmp_dir && \ cd /tmp

Unzip all zipped files in a folder to that same folder using Python 2.7.5

寵の児 提交于 2019-12-03 03:58:44
问题 I would like to write a simple script to iterate through all the files in a folder and unzip those that are zipped (.zip) to that same folder. For this project, I have a folder with nearly 100 zipped .las files and I'm hoping for an easy way to batch unzip them. I tried with following script import os, zipfile folder = 'D:/GISData/LiDAR/SomeFolder' extension = ".zip" for item in os.listdir(folder): if item.endswith(extension): zipfile.ZipFile.extract(item) However, when I run the script, I

How can I read files from Zip file to memory with Java?

左心房为你撑大大i 提交于 2019-12-03 03:20:27
I found example from SUN site (http://java.sun.com/developer/technicalArticles/Programming/compression/), but it returns BufferedOutputStream. But I would like to get ZipEntry file as InputStream and then process next file. Is that possible? My program has no access to harddisk, so it cannot even temporarily save files. import java.io.*; import java.util.zip.*; public class UnZip { final int BUFFER = 2048; public static void main (String argv[]) { try { BufferedOutputStream dest = null; FileInputStream fis = new FileInputStream(argv[0]); ZipInputStream zis = new ZipInputStream(new

How to open gzip text files in Gvim without unzipping?

回眸只為那壹抹淺笑 提交于 2019-12-03 01:31:57
How to open Gzipped text files (*.gz) in Gvim without unzipping them first ? Jean Solution mentioned in VimDocs as answered by therefromwhere augroup gzip autocmd! autocmd BufReadPre,FileReadPre *.gz set bin autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip autocmd BufReadPost,FileReadPost *.gz set nobin autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r") autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r autocmd FileAppendPre *.gz !gunzip <afile> autocmd FileAppendPre *.gz !mv <afile>:r

.zip文件过大时候解压报错

匿名 (未验证) 提交于 2019-12-03 00:34:01
今儿开发人员找过来说解压缩一个压缩包失败了,一般出现这个问题有两种情况 1、通过查看发现unzip会有大小限制的情况 2、还有一种情况就是压缩包没有被下载完整所导致 一般出现解压失败这种情况,需要使用 7zip来解压 wget http://downloads.sourceforge.net/project/p7zip/p7zip/9.13/p7zip_9.13_src_all.tar.bz2r=http://sourceforge.net/projects/p7zip/files/&ts=1283040874&use_mirror=voxel tar -jxvf p7zip_9.13_src_all.tar.bz2 cd p7zip_9.13 make make install 安装完成, 7za x data.zi成功了 一、Linux 下,使用unzip解压时,报错: unzip trunk.zip 文件大小为 2.2G,可能是 unzip 设置了这个限制吧。在网上查到要用 jar 来解:jar xvf trunk.zip (1).如果出现 jar:Command not found (2).要用yum下载 yum -y install Java-1.6.0-openjdk-devel (3).再次运行 jar xvf trunk.zip 原文:http://blog

How to zip (and unzip) byte[] in C#?

二次信任 提交于 2019-12-02 21:33:11
问题 How can I zip (and unzip) a byte array in C#? Is it efficient to use zip/unzip on byte arrays with less than 100 elements? 回答1: DotNetZip is the library I have used to handle zip/unzip in .NET . If you don't care about the format and if you are just looking for a compression technique, you could look into GZipStream class that's built into .Net framework. Here's an example. . Compression is one thing that's highly subjective based on the content. You could do a few tests with your elements to

What is the fastest way to extract 1 file from a zip file which contain a lot of file?

流过昼夜 提交于 2019-12-02 19:31:33
I tried the java.util.zip package, it is too slow. Then I found LZMA SDK and 7z jbinding but they are also lacking something. The LZMA SDK does not provide a kind of documentation/tutorial of how-to-use, it is very frustrating. No javadoc. While the 7z jbinding does not provide a simple way to extract only 1 file, however, it only provide way to extract all the content of the zip file. Moreover, it does not provide a way to specify a location to place the unzipped file. Any idea please??? What does your code with java.util.zip look like and how big of a zip file are you dealing with? I'm able

zip and unzip in java

故事扮演 提交于 2019-12-02 13:25:46
I know that it is an easy task, but after changing my code it stopped working and I can't get it back! I use two functions to zip and unzip, even though what it actually does is "jar" and "unjar", but that shouldn't make a huge difference public static void zipit(File[] infiles, JarOutputStream jos) throws Exception { zipit(infiles,"", jos); } public static void zipit(File[] infiles, String root, JarOutputStream jos) throws Exception { byte[] buffer = new byte[4096]; for(int i=0; i<infiles.length; i++) { // recursive call for subfolders... temporary if(infiles[i].isDirectory()) { zipit(infiles

Unzipping a file from C++ on Redhat: alternatives to system()

一个人想着一个人 提交于 2019-12-02 13:24:46
问题 I need to unzip a file while running a C++ program (as described in Waiting for unzip to finish before carrying on C++ code on a RedHat machine) To do this I currently do something like this: system("unzip /usr/bin/File/ZippedFile.gz -d /usr/bin/File/) Which unzips "/usr/bin/File/ZippedFile.gz" to "/usr/bin/File/ZippedFile" with no problems. This works fine. However I have noticed that many people seem to say that using system() is taboo. People don't seem to like it as due to security and

Can we ZIP/Unzip files larger than 4GB using .Net 4.5 libraries?

我只是一个虾纸丫 提交于 2019-12-02 10:27:17
We have an original zip library which uses the SharpZipLib and .NET 2.0. We need to research what is now possible in .NET 4.5 using System.IO.Compression and System.IO.Compression.ZipArchive. Should we use .NET 4.5 libraries or use a 3rd party open source library? Also, we need to be able to zip/unzip files larger than 4GB. Samples, blogs, any help is welcomed. Thank you Suresh 4GB is the maximum addressible size for a 32-bit pointer, hence it will not work for larger file. But you can try Zip64 which will work for larger files. This post might help you. Hope this will help! Thanks Suresh 3rd