I use the following script to move the files in my directory (in this case My_Theme ) to the wordpress.zip zip archive.
define('CLIENT_PATH', $_SERVER['DOCUMENT_ROOT'] . '/wp_theme/clients_templates/' . str_replace(' ', '_', $_POST['title'])); $zip = new ZipArchive; $zip->open('wordpress.zip', ZipArchive::CREATE); foreach (glob(CLIENT_PATH . "/*.*") as $file) { echo $file . '<br>'; $zip->addFile($file); } $zip->close();
Now, when I download and unzip this file, my folder structure looks like this:

I want to move the My_Theme directory to wordpress/wp-content/themes/
Result: wordpress/wp-content/themes/My_Theme (including all files and subdirectories inside)
How can i do this?
php zip ziparchive
Reza
source share