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


Groups > comp.lang.php > #14357

unzip without extracting directory (was: unzio without directory)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!newsfeed.fsmpi.rwth-aachen.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 unzip without extracting directory (was: unzio without directory)
Date Thu, 16 Oct 2014 04:00:05 +0200
Organization PointedEars Software (PES)
Lines 38
Message-ID <3921955.eAtPLq5odn@PointedEars.de> (permalink)
References <m1l7sb$3fa$1@news.albasani.net>
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 1413424808 14897 eJwFwQEBADAEBMBKDI842PSPsDsTMMYVBrW15dHuGH9JlZIoOMcdibyLVio5oParwHac9wEdIhEP (16 Oct 2014 02:00:08 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Thu, 16 Oct 2014 02:00:08 +0000 (UTC)
User-Agent KNode/4.14.1
X-User-ID eJwNyMEBwCAIA8CVqkAI4wjC/iPU550JFsoVBrWxWXC/qw/iSBhJ57ml1Oj3OzKr8fz2s5K8hNCh02mMHT9IGBU7
Cancel-Lock sha1:Gdm6PfPYIVyTHkb4Np/P1BNcuYM=
X-NNTP-Posting-Host eJwFwQkBwDAIA0BLBRJW5PAM/xJ6R3Px/uB0cLnbmJMOYW50KsWwEVcrjoZBMbc0rTnC0v8BGDkQyA==
Xref csiph.com comp.lang.php:14357

Show key headers only | View raw


Jan Novak wrote:

> i have this code for unzipping:
> 
> 
> $file = $fileName;

This is pointless.  Why not use $fileName in the following?

> $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:
> […]

That is not a question, and you have been negligent with your Subject header 
field value, too: <http://www.catb.org/~esr/faqs/smart-questions.html>

Next time, RTFM first (took me less than 10 seconds to find it):

<http://php.net/manual/en/ziparchive.extractto.php#100802>
 
-- 
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