Raketenwilli: Eine Frage noch: Warum nicht 'zip --move -T' ?Da kannst Du das ganze Löschen-Gefummel sparen.

Beitrag lesen

Eine Frage hab ich noch:

man zip „sagt“:

-m --move
Move  the specified files into the zip archive; actually, this
deletes the target directories/files after making the specified
zip archive. If a directory becomes empty  after removal of the
files, the directory is also removed.
No deletions are done until zip has created the archive without
error. This is useful for conserving disk space, but is
potentially dangerous  so it is recommended to use it in
combination with -T to test the archive before removing all input
files.

Warum also nicht zip -mT ... - Da kannst Du das ganze Löschen-Gefummel sparen.

<?php
define( 'DEBUG', true );
$subFolder   = '0815';
$target_path = '/tmp/test/upload/' . $subFolder;
$zip_name    = $subFolder . '.zip';
$zip_files   = $target_path;
$sys = 'zip  ' 
	 . escapeshellarg( $target_path . '/' . $zip_name ) 
	 . ' -mT0jv ' . escapeshellarg( $zip_files) 
	 . '/*';
if ( DEBUG ) echo htmlspecialchars( $sys, ENT_NOQUOTES )
                  . PHP_EOL;
$result = system( $sys );

if ( DEBUG ) echo 'Ausgaben:' 
				  . PHP_EOL 
				  . htmlspecialchars( $result, ENT_NOQUOTES );