Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14371

Re: unzip without extracting directory

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.internetdienste.de!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.php
Subject Re: unzip without extracting directory
Date Thu, 23 Oct 2014 05:57:09 +0200
Organization PointedEars Software (PES)
Lines 39
Message-ID <4568324.GT5VcWPXNi@PointedEars.de> (permalink)
References <m1l7sb$3fa$1@news.albasani.net> <3921955.eAtPLq5odn@PointedEars.de> <m1n970$fud$1@dont-email.me>
Reply-To Thomas 'PointedEars' Lahn <php@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1414036630 25071 eJwFwYkRwCAMA7CVCs4D4/hwvP8IlRK16nVUVqTTzQlunk+47FMXUqNX4MX2GuagDIsWFPMDHNoRlg== (23 Oct 2014 03:57:10 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Thu, 23 Oct 2014 03:57:10 +0000 (UTC)
User-Agent KNode/4.14.1
X-User-ID eJwNy8ERACEIA8CWECQZy8Fw9F+Ct//NwIK4kdg5ObXSKU8L47iFl1AZsG7D4e2veLn+EXTJDgs20myvaeABNdMVSg==
Cancel-Lock sha1:1q71oJ3glsOY59hxbh7GFVbsqes=
X-NNTP-Posting-Host eJwFwYEBwCAIA7CXRNoOzpmO/n/CEqZC94Eo0PT4OKemr9RYhxG7pDSRTPlbcwB1IWdvvz8b8RC1
Xref csiph.com comp.lang.php:14371

Show key headers only | View raw


Jerry Stuckle wrote:

> On 10/15/2014 10:00 PM, Thomas 'PointedEars' Lahn wrote:
>> Jan Novak wrote:
>>> $path = pathinfo(realpath($file), PATHINFO_DIRNAME);
>>> $zip = new ZipArchive;
>>> $res = $zip->open($file);
>>> if ($res === TRUE) {
>>> $zip->extractTo($path);
>>> $zip->close();
>>> echo "OK";
>>> } else {
>>> echo "Fail";
>>> }
>>>
>>> This works fine - but the zip file contains a directory structure like
>>> this:
>>> […]
>>> I want only everything without Dir0. So that i get files like this:
>>> […]
>> 
>> Next time, RTFM first (took me less than 10 seconds to find it):
>> 
>> <http://php.net/manual/en/ziparchive.extractto.php#100802>
> 
> Maybe if you understood ANYTHING you would understand this does NOT
> resolve her problem. 

Wrong.  This is not a repository for complete solutions.  I am and I have 
been fully aware that the code there needs only a *slight* adaptation to do 
*exactly* what the OP is looking for.  Do you know which?

BTW, Jan is a *male* given name; not to be confused with, e.g. Jana or Jane.

-- 
PointedEars
Zend Certified PHP Engineer
Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

unzio without directory Jan Novak <repcom@gmail.com> - 2014-10-15 09:30 +0200
  Re: unzio without directory Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-15 06:18 -0400
    Re: unzio without directory Jan Novak <repcom@gmail.com> - 2014-10-15 12:54 +0200
      Re: unzio without directory Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-15 12:17 -0400
  unzip without extracting directory (was: unzio without directory) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-16 04:00 +0200
    Re: unzip without extracting directory Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-15 22:06 -0400
      Re: unzip without extracting directory Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-23 05:57 +0200
        Re: unzip without extracting directory Jan Novak <repcom@gmail.com> - 2014-10-23 08:32 +0200
          Re: unzip without extracting directory Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-23 05:56 -0400
        Re: unzip without extracting directory Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-23 05:55 -0400
          Re: unzip without extracting directory Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-23 18:44 +0200
            Re: unzip without extracting directory Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-23 20:10 -0400
              Re: unzip without extracting directory Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-27 13:36 +0100

csiph-web