unzip

PHP Unzip very large file

浪尽此生 提交于 2019-12-05 18:11:05
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? 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 extract the files. $filename = '/media/file.gz'; $unzipped_content = ''; $zd = gzopen($filename, "r"); while

centos6.8安装上传上载文件

我只是一个虾纸丫 提交于 2019-12-05 17:37:00
centos6.8安装上传上载文件 首先要安装RZ功能命令为:# yum install lrzsz Linux(Centos6.5)下如何解压.zip和.rar文件 Windows下常见的压缩文件类型是.zip和.rar。在Linux下如何压缩和解压缩呢? 1、zip linux下提供了zip和unzip命令。zip是压缩,unzip是解压缩。举例如下: #zip myFile.zip *jpg 将所有jpg文件压缩成一个压缩包。 #unzip myFile.zip 将myFile.zip中的所有文件解压出来。 2、rar Linux下默认未提供rar文件的处理,需要单独安装RAR For Linux。下载地址: http://www.rarsoft.com 。 截止目前最新版本是RAR 5.10,我选择的是RAR5.10 for Linux x64。 下载后的安装方法: tar -xzpvf rarlinux-x64-5.1.0.tar.gz cd rar make 之后rar已经成功安装。之后系统里就有rar和unrar这两个命令。前者是压缩程序,后者是解压缩程序。 举例: #rar a myFile *.jpg 这条命令将所有jpg文件压缩成一个rar包,名为myFile.rar,后缀名.rar是自动添加的。 #unrar e myFile.rar 将myFile

ZipInputStream doesn't report *actual* (i.e. compressed) bytes read

落爺英雄遲暮 提交于 2019-12-05 14:34:53
Love this website! My issue is as follows: I'm reading a zip file that's coming over a network from an HTTP "PUT" request. The request header tells me that the Content-Length is (say) 1Mb. The following code creates the ZipInputStream, and saves the zip contents to files in the current directory: ZipInputStream zis = new ZipInputStream(inputStream); ZipEntry ze; long totalBytesRead = 0; while ((ze = zis.getNextEntry()) != null) { BufferedOutputStream outStream = new BufferedOutputStream(new FileOutputStream(ze.getName())); byte[] buffer = new byte[4096]; int i; while ((i = zis.read(buffer)) !=

How do I flatten the top level folder of a zip file with ant?

帅比萌擦擦* 提交于 2019-12-05 13:52:58
A lot of zip files have a root folder, how do I unpack the zip file and get rid of the root folder? I know there is the globmapper : <unzip dest="${dest.path}"> <fileset dir="${source.path}"> <include name="**/zipfile*.*.zip" /> </fileset> <mapper> <globmapper from="rootFolder/*" to="*" /> </mapper> </unzip> But what if I don't know the name of the root folder? Wildcards are not working e.g. <globmapper from="root*Folder/*" to="*" /> Is there a way to use wildcards or a mapper/function that upacks without the root folder? There's actually a separate mapper specifically made for this called

How can I unzip a specific folder?

六眼飞鱼酱① 提交于 2019-12-05 13:11:40
问题 How can I unzip a specific folder with Ant? Specifically, I have downloaded apache-tomcat-6.0.29.zip which contains the folder "apache-tomcat-6.0.29". I want Ant to unzip everything under "apache-tomcat-6.0.29" but not include "apache-tomcat-6.0.29" in the top of hierarchy. I've tried a bunch of things, but I can't seem to get it to work. Here's my latest attempt: <unzip dest="${release.dir}/image/tomcat" src="${tomcat.zip}"> <patternset> <include name="apache-tomcat-6.0.29/*"/> </patternset>

android unzip folder from zip file and read content from that folder

匆匆过客 提交于 2019-12-05 13:10:22
in one of my app i need to extract a zip file that have folder inside and that folder contains images it mean abc.zip=>adb(folder)=>abc.png i want to extract image file i used below method private boolean extractFolder(File destination, File zipFile) throws ZipException, IOException { int BUFFER = 8192; File file = zipFile; //This can throw ZipException if file is not valid zip archive ZipFile zip = new ZipFile(file); // String newPath = destination.getAbsolutePath() + File.separator + FilenameUtils.removeExtension(zipFile.getName()); String newPath = destination.getAbsolutePath() + File

unzip specific extension only

[亡魂溺海] 提交于 2019-12-05 10:51:22
I have a a directory with zip archives containing .jpg, .png, .gif images. I want to unzip each archive taking the images only and putting them in a folder with the name of the archive. So: files/archive1.zip files/archive2.zip files/archive3.zip files/archive4.zip Open archive1.zip - take sunflower.jpg, rose_sun.gif. Make a folder files/archive1/ and add the images to that folder, so files/archive1/folder1.jpg, files/archive1/rose_sun.gif. Do this to each archive. I really don't know how this can be done, all suggestions are welcome. I have over 600 archives and an automatic solution would be

Unzip returns error 1 for a zip file in R [closed]

天涯浪子 提交于 2019-12-05 10:21:48
I am trying to load a medium sized zipped archive (.zip file ~140 Mb) that can be found here (direct link) (source: Deutsche Bundesbank (website) ). After downloading the file it is saved as "BKK-Download.zip". The file contains ~50.000s xml files with some rather strange names (such as "bbai3.q.de.n.v.bf90.f.kv.a1.s.2.n.e.z.xml") in three subfolders. In a first step I try to open the "tree.xml" file in the "tree" folder, in a second step I will open the file using the XML package. I try the first step by using the unzip function: f.path <- "path to the file" dat <- unzip(paste0(f.path, "BKK

How do I get a zipped file's content using the rubyzip library?

孤者浪人 提交于 2019-12-05 06:58:19
I'm trying to extract an uploaded zip file and store its contents in the database, one entry per file. The rubyzip library has nearly no useful documentation. There is an assets table that has key :string (file name) and data :binary (file contents). I'm using the rubyzip library, and have made it as far as this: Zip::ZipFile.open(@file_data.local_path) do |zipfile| zipfile.each do |entry| next if entry.name =~ /__MACOSX/ or entry.name =~ /\.DS_Store/ or !entry.file? asset = self.assets.build asset.key = entry.name asset.data = ?? # what goes here? end end How can I set the data from a

Unzipping larger files with PHP

五迷三道 提交于 2019-12-05 06:39:25
I'm trying to unzip a 14MB archive with PHP with code like this: $zip = zip_open("c:\kosmas.zip"); while ($zip_entry = zip_read($zip)) { $fp = fopen("c:/unzip/import.xml", "w"); if (zip_entry_open($zip, $zip_entry, "r")) { $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); fwrite($fp,"$buf"); zip_entry_close($zip_entry); fclose($fp); break; } zip_close($zip); } It fails on my localhost with 128MB memory limit with the classic " Allowed memory size of blablabla bytes exhausted ". On the server, I've got 16MB limit, is there a better way to do this so that I could fit into this