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


Groups > comp.lang.php > #14352

unzio without directory

From Jan Novak <repcom@gmail.com>
Newsgroups comp.lang.php
Subject unzio without directory
Date 2014-10-15 09:30 +0200
Organization albasani.net
Message-ID <m1l7sb$3fa$1@news.albasani.net> (permalink)

Show all headers | View raw


Hi,
i have this code for unzipping:


$file = $fileName;
$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:

RootDirectoryDir0
	File1
	File2	
	...
	<Dir1>
		File1
		...
	<Dir2>
		File1
		...

I want only everything without Dir0. So that i get files like this:
	File1
	File2	
	...
	<Dir1>
		File1
		...
	<Dir2>
		File1
		...



Jan

Back to comp.lang.php | Previous | Next — 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